Collection enum

Posts   
 
    
Kjelli
User
Posts: 27
Joined: 11-May-2006
# Posted on: 04-Oct-2006 16:25:04   

Is there a enum similar to EntityType for collections?

If there is an enum I can use the following statement to get a collection:

IEntityCollection collection = (IEntityCollection)Activator.CreateInstance(Assembly.GetExecutingAssembly().GetType(enum.ToString()));

The enum would be passed as parameter to this method. I don't like passing Types as parameters unless I really have to.

Couldn't find any hint in the entity class either.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Oct-2006 16:49:14   

What version of LLBLGen Pro are you using? .Net version? SelfServicing or Adapter?

Please follow the guidlines mentioned here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725

Kjelli
User
Posts: 27
Joined: 11-May-2006
# Posted on: 05-Oct-2006 08:43:23   

Sorry. Just read the guidelines and I must confess I posted to an old thread also yesterday simple_smile

Alright.

Using latest release of 2.0. Selfservicing. .Net 2.0.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 05-Oct-2006 09:48:54   

There's no such enum, but you could use the enum value of EntityType, call ToString(), then replace 'Entity' with 'Collection' at the end and use the name to instantiate the type.

Frans Bouma | Lead developer LLBLGen Pro
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Oct-2006 10:24:57   

You can write your own enum directly in the ContantEnums.cs generated class, inside the following code region: **// __LLBLGENPRO_USER_CODE_REGION_START CustomUserConstants**

Also you can modify the constantsEnums.template to automatically generate this enum for you. I think those lines will do:


<[If HasEntity]>
    /// <summary>
    /// Enum definition for all the entityCollections types
    /// </summary>
    public enum EntityCollectionType:int
    {
                                <[Foreach Entity CommaCrLf]>
        <[CurrentEntityName]>EntityCollection<[NextForeach]>
    }
<[EndIf]>

Kjelli
User
Posts: 27
Joined: 11-May-2006
# Posted on: 05-Oct-2006 10:37:01   

Thank you guys!