How to read Custom Attributes using reflection set by Fluent API in EF 4.1

后端 未结 1 1650
太阳男子
太阳男子 2021-01-25 12:32

I\'ve managed to read custom attributes when I use data annotation. like following code.

Object[] test = propertyInfo.GetCustomAttributes(typeof(KeyAttribute), t         


        
相关标签:
1条回答
  • 2021-01-25 13:09

    Fluent API does not set attributes. Fluent API and Attributes tell EF how to build the model.

    These are two different ways to achieve the same thing. That is to build the Model.

    Edit

    If you need to retrieve the metadata such as primary keys you need to access the MetadataWorkspace.

    This article has the details.

    0 讨论(0)
提交回复
热议问题