New Posts New Posts RSS Feed: Create vs Construct
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Create vs Construct

 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: Create vs Construct
    Posted: 11-Mar-2009 at 4:21am
Hi,
 
Just wondering what your current thoughts are regarding constructor overloading versus using static create methods.  If I recall right, in DevForce classic, using static create methods was the preferred way and was explicitly noted as such.  However, in DevForce EF I'm not seeing any specific information regarding this.
 
The problem I always had with using static Create methods was that it made it impossible to use object initializers, so I'd prefer to overload constructors, but is there a reason why this might be a bad idea with DevForceEF?
 
Thanks,
Ken
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 12-Mar-2009 at 4:32pm
DevForce EF allows entity creation via a standard constructor, which DevForce Classic does not allow, so the static Create factory methods defined in each entity were one way of highlighting the issue.  In DevForce EF, "new"ing an Entity is allowed, and we're also more enthusiastic about using the Repository and other pertinent patterns.   Our intention really isn't to force you into any pattern.   Overloaded constructors work fine in DevForce EF, just be sure that you call AddToManager to make the new entity part of an EntityManager cache.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down