문제

Is it possible to add some of property or variable or custom attribute to a particular column or navigation property within the EDMX designer so I can utilize it in my T4 template?

I want to be able to say (in my T4 template) "If this property is set, write an [XmlIgnore] attribute for this property."

I don't want to have to go into my T4 template and hard code property names.

도움이 되었습니까?

해결책

Edmx can be extended by adding attributes or elements to existing elements. The only limitation is that the attribute cannot be in the namespaces EF is using or the empty namespace. For instance you can do something like this (with the Xml editor):

<Property Name="Value" Type="Int32" Nullable="false" ns:WriteIgnore="true" xmlns:ns="my-namespace-uri" />

Once the edmx is loaded to an item collection you will be able to access this custom property by reading MetadataProperties of the annotated item (in this case it would be the Property)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top