开发者

How to define and add a enum as type

开发者 https://www.devze.com 2023-01-21 11:37 出处:网络
I am working on custom data provider u开发者_开发知识库sing ADO .NET Entity Framework. In the CreateMetaData function, I need to add primitive and complex properties in the ResourceType.

I am working on custom data provider u开发者_开发知识库sing 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.


As mentioned here Enums are not supported in Entity Framework 4. But it can be achieved using POCO classes.

0

精彩评论

暂无评论...
验证码 换一张
取 消