How to define and add a enum as type
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.
精彩评论