Pluggable Conventions in Entity Framework

♀尐吖头ヾ 提交于 2019-12-08 01:46:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!