When to use EntityFactory ?

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 16-Feb-2010 12:46:30   

When I'm fetching an entity collection,first I create a new empty collection. There is a parameter for an EntityFactory in the entity collection contructor. I tried to fetch the collection with an EntityFactory and without. Both ways did work.

So when to use the EntityFacory class ?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 16-Feb-2010 21:43:09   

Setting an EntityFactory into a collection class allows the collection to create new objects. This can be by you call collection.AddNew, which will return a new entity, or if the collection is bound to a grid which allows the user the to add new rows, for example.

If you are not doing either of these, then as you have found the collection will work perfectly well without the factory present.

Matt