New Posts New Posts RSS Feed: Partial class fields not being initialized
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Partial class fields not being initialized

 Post Reply Post Reply
Author
ken.nelson View Drop Down
Groupie
Groupie


Joined: 03-Mar-2009
Location: Ann Arbor, MI
Posts: 54
Post Options Post Options   Quote ken.nelson Quote  Post ReplyReply Direct Link To This Post Topic: Partial class fields not being initialized
    Posted: 21-Jul-2010 at 11:30am
We've been struggling with the rather arduous task of upgrading (rebuilding) our model from DevForce 2009 to DevForce 2010.  We're nearing the end of the transition, and ran into something unexpected.  Some of our partial classes have fields that get initialized (example: bool someField = true;).  Well, in DevForce 2009, after fetching the entity via the entity manager, the fields in our partial classes were initialized properly, however in DevForce 2010 this does not appear to be the case.  It appears that the initializer is hit on the server but not on the client, and for whatever reason those fields are also not being serialized.  We also don't appear to be hitting the entity contructor on the client. 
 
What is the best strategy for initializing partial class fields so that they're correctly initialized on the client?
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jul-2010 at 4:04pm

This is per design, that there is actually a comment in the DF2010 release notes for version 6.0.1.

 A custom field intializer that you added to your entity (e.g., private int foo = 42;) may not always be set for every new instance. Our client-side “entity materialization” logic can by-pass field initializations. To ensure that “foo” is initialized, either set it lazily or mark “foo” as a WCF DataMember

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down