Asp.net mvc 如何从PropertyInfo或元数据中检测[NotMapped]注释?
如果我有一个属性的Asp.net mvc 如何从PropertyInfo或元数据中检测[NotMapped]注释?,asp.net-mvc,reflection,entity-framework-4,entity-framework-4.1,ef-code-first,Asp.net Mvc,Reflection,Entity Framework 4,Entity Framework 4.1,Ef Code First,如果我有一个属性的PropertyInfo,或者该属性的MVC元数据,我如何检测它是否有EF CodeFirst的[NotMapped]注释?谢谢。你可以这样做: youPropertyInfo.GetCustomAttributes(typeof(NotMappedAttribute), true).Count() > 1
PropertyInfo
,或者该属性的MVC元数据,我如何检测它是否有EF CodeFirst的[NotMapped]
注释?谢谢。你可以这样做:
youPropertyInfo.GetCustomAttributes(typeof(NotMappedAttribute), true).Count() > 1