Getting an EntityFactory

Posts   
 
    
Posts: 5
Joined: 13-Jun-2006
# Posted on: 13-Jun-2006 17:55:53   

Is there an easy way to get an EntityFactory from a string at runtime without writing custom code? Something like this:


string entityName = "EmployeeEntity";
IEntityFactory2 myFactory = /* some magic with entityName */;
IEntityBase2 myEntity = myFactory.Create();


Also, there is a EntityFactorySelector form in ORMSupportClasses. How can this form be used? I only ever get an empty combobox.

Thanks, Kevin

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 13-Jun-2006 23:49:38   

A user had a similar situation that they solved with a method that returned an EntityCollection filled with the correct entities. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=712&HighLight=1 Let us know if this helps.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 14-Jun-2006 09:13:29   

The entityfactoryselector is used at design time in vs.net, thus can't be used outside it.

You also might want to look at the Activator class in .NET by passing in a Type object created from the string "<entityname>Factory"

Frans Bouma | Lead developer LLBLGen Pro