问题
I am following EF Feature CTP5: Pluggable Conventions to create custom pluggable convention (in this particular case to change the precision of all decimal fields).
Looks like in the latest release of EF the Add
method on ConventionsConfiguraions
is also "internal'. How do i add custom Pluggable Conventions now?
回答1:
The feature has been removed in EF 4.1 and a possible implementation postponed to a later release:
Code First customizable (pluggable) conventions are not supported. Removing the default Code First conventions is supported.
Quote from here: http://msdn.microsoft.com/en-us/library/gg696165%28v=VS.103%29.aspx
And:
Removal of Code First Pluggable Conventions. Pluggable Conventions were previewed in Feature CTP5 but were not at go-live quality for this release. This release still supports the removal of default conventions.
Quote from here: http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-release-candidate-available.aspx
That's why Add
doesn't exist anymore as a public method of ConventionsConfiguration
, only Remove
is still available.
回答2:
I have blogged about an alternative way of defining conventions here: http://sessionfactory.blogspot.com/2011/04/conventions-in-entity-framework-41.html
来源:https://stackoverflow.com/questions/5681662/pluggable-conventions-in-entity-framework