nikkishri / dropthings

Automatically exported from code.google.com/p/dropthings
0 stars 0 forks source link

How can I create userSettingTemplates apart from existing two ? #78

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I downloaded your code and it workes fine.

I saw two template named anon_template and registered_template in 
web.config file. What I want is to create a new template. 

My requirement is to have different template as per role, 

for eg, 
anon user - anon
admin user - adm
type1 user - typ1
type2 user - typ2

Is this possible ? 

Original issue reported on code.google.com by ravisoft...@gmail.com on 27 Apr 2010 at 1:09

GoogleCodeExporter commented 9 years ago
Did you try adding another entry to this with a different user and role name?

<userSettingTemplates cloneAnonProfileEnabled="true" 
cloneRegisteredProfileEnabled="true">
    <templates>
      <clear />
      <add key="anon_template" userName="anon_user@yourdomain.com" 
password="changeme" roleNames="Guest" templateRoleName="Guest" />
      <add key="registered_template" userName="reg_user@yourdomain.com" 
password="changeme" roleNames="RegisteredUser" 
templateRoleName="RegisteredUser" />
    </templates>
  </userSettingTemplates>

You can create different user, setup the page, and then use that user's ID here 
as a 
template. 

Original comment by omaralzabir@gmail.com on 30 Apr 2010 at 6:24

GoogleCodeExporter commented 9 years ago

I tried adding another user template and ran setup.aspx but I get the error 
below:

A referential integrity constraint violation occurred: A property that is a 
part of referential integrity constraint cannot be changed when the object has 
a non-temporary key.

in the file:
DropthingsDataContext2.cs

public void ApplyReferencePropertyChanges(
            IEntityWithRelationships newEntity,
            IEntityWithRelationships oldEntity)
        {
            foreach (var relatedEnd in oldEntity.RelationshipManager.GetAllRelatedEnds())
            {
                var oldRef = relatedEnd as EntityReference;
                if (oldRef != null)
                {
                    // this related end is a reference not a collection
                    var newRef = newEntity.RelationshipManager.GetRelatedEnd(oldRef.RelationshipName, oldRef.TargetRoleName) as EntityReference;
                    oldRef.EntityKey = newRef.EntityKey;  <<< ERROR HERE
                }
            }
        }

Original comment by b1ad...@gmail.com on 4 Oct 2010 at 3:34

GoogleCodeExporter commented 9 years ago
What's the newRef.EntityKey value and what's the newRef.TargetRoleName?

Original comment by omaralzabir@gmail.com on 13 Dec 2010 at 2:41

GoogleCodeExporter commented 9 years ago
newRef.EntityKey value > null
newRef.TargetRoleName > "aspnet_User"

Original comment by b1ad...@gmail.com on 25 Jan 2011 at 3:31

GoogleCodeExporter commented 9 years ago
from research I think the error is related in updating a foreign key which is a 
primary key as well.

Original comment by b1ad...@gmail.com on 25 Jan 2011 at 4:17