简体   繁体   中英

How to define and add a enum as type

I am working on custom data provider using ADO .NET Entity Framework.

In the CreateMetaData function, I need to add primitive and complex properties in the ResourceType.

I believe Enum should be added as the complex data type.

If yes, how can I add this? Any pointer would be a great help.

Thanks,

Ram

An enum can be initialized as following:

public enum MyEnum
{
    FirstEntry,
    SecondEntry,
    ThirdEntry
}

You can access it using MyEnum.FirstEntry .

The enum can be added to a class as a property, for example:

public MyEnum NumberOfEntry { get; set; }

I hope this answers your question.

如前所述这里枚举不是在实体框架4的支持,但它可以使用POCO类来实现。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM