|
|
piscario
User
Location:
Joined on: 11-Mar-2010 14:32:57
Posted: 6 posts
|
Hi there
I have a problem with an Entity that is getting its IsDirty property set to true after it is being deserialized by WCF. This is causing problems on saving as the Entity isn't dirty and should not be saved as we have a permission model that allows read only viewing of certain records.
Basically we have a collection of roles on a Contact and it is these roles that are having the Dirty flag reset. When the Contact entity is saved we set to save related entities and if the user does not have permission for any of these we make sure that the related collections will not be saved by checking what would be updated on the server. The databse has Triggers that are the last defense against unpermitted updates.
There is no custom properties or serialization and we are using wsHttpBinding on WCF.
No Properties or Collections on the Role are Dirty with the exception of the related Contact being saved.
It seems that no other properties on the contact role have changed other than IsDirty.
We are running genpro 2.6 final.
Any thoughts on why this would be happening. Help appreciated
|
|
|
MTrinder
Support Team
Location: London by day, Milton Keynes by night.
Joined on: 08-Oct-2008 17:55:47
Posted: 994 posts
|
If you debug through the process can see where/when the flags change to IsDirty ?
Can you tell which property IsChanged...?
Matt
|
|
|
piscario
User
Location:
Joined on: 11-Mar-2010 14:32:57
Posted: 6 posts
|
On the Client before WCF serialization
Contact.ContactRoles.ContainsDirtyContents= false Contact.ContactRoles[0].IsDirty = false
On the Server after deserialzation
Contact.ContactRoles.ContainsDirtyContents= true Contact.ContactRoles[0].IsDirty = true
When the ContactRole entity is saved it is only saving the ContactId to the database. This field has not changed in anyway on the client.
We dont explictly prefetch the contact roles on the contact because of how our application works we rather AddRange to the Collection when needed. This does set IsDirty = true for the ContactRoles which we manually change back to false.
Does this internaly set that the ContactId on the ContactRole has changed because it is a FK. We have other Entities that work in this was but we are not getting the IsDirty Deserialization problems.
|
|
|
Walaa
Support Team
Location: Egypt
Joined on: 21-Aug-2005 16:03:48
Posted: 9817 posts
|
Doing:
| Code: |
myContact.ContactRoles.Add(myContactRole); |
myContactRole's FK to COntact will be set, and thus the entity would be dirty.
|
|
|
piscario
User
Location:
Joined on: 11-Mar-2010 14:32:57
Posted: 6 posts
|
| Walaa wrote: |
Doing:
| Code: |
myContact.ContactRoles.Add(myContactRole); |
myContactRole's FK to COntact will be set, and thus the entity would be dirty. |
Thats why we manually set it back to false as the state it is on when we get the Roles a while after the Contact is essentially not Dirty. We have just got the collection from the DB and at this point in time it will represent what is in the ContactRole Table
It is only on the Deserialization that it gets set back to true and as nothing has really changed we dont want any updates to happen on the row. The ContactId on the ContactRole is the same.
|
|
|
Walaa
Support Team
Location: Egypt
Joined on: 21-Aug-2005 16:03:48
Posted: 9817 posts
|
Which exact runtime library build (number) are you using?
|
|
|
piscario
User
Location:
Joined on: 11-Mar-2010 14:32:57
Posted: 6 posts
|
In RuntimeLibraries\DotNET35
SD.LLBLGen.Pro.ORMSupportClasses.CF35.dll File Version 2.6.0.0 Assembly Version 2.6.0.0
All the Dll's in the LLBLGen Pro v2.6 folder are 2.6.0.0
|
|
|
Walaa
Support Team
Location: Egypt
Joined on: 21-Aug-2005 16:03:48
Posted: 9817 posts
|
I need that of the one used in the server side for deserialization. (SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll)
|
|
|
piscario
User
Location:
Joined on: 11-Mar-2010 14:32:57
Posted: 6 posts
|
Sorry
File Verison 2.6.8.709 Assembly Version 2.6.0.0
|
|
|
Walaa
Support Team
Location: Egypt
Joined on: 21-Aug-2005 16:03:48
Posted: 9817 posts
|
| Quote: |
| File Verison 2.6.8.709 |
That's almost 2 years old, would you please try using the latest build before we dig deep on this.
Thanks.
|
|
|
piscario
User
Location:
Joined on: 11-Mar-2010 14:32:57
Posted: 6 posts
|
This isnt something I can do in the next few days so I will have to get back to you next week.
I will have to implement a workaround in the mean time so that we dont save the contact roles we shouldn't.
Thanks
|
|
|
daelmo
Support Team
Location: Guatemala City
Joined on: 28-Nov-2005 23:35:24
Posted: 3995 posts
|
We will wait for your reply...
|
|
|