开发者

Is there any way I can store more attributes with fields/classes in Entity Framework?

开发者 https://www.devze.com 2023-01-14 22:48 出处:网络
By default Navigation Properties in Entity Frameworks creates properties at both the end of associations, now the problem I am facing is, I want to mark s开发者_开发技巧ome associations to generate pr

By default Navigation Properties in Entity Frameworks creates properties at both the end of associations, now the problem I am facing is, I want to mark s开发者_开发技巧ome associations to generate properties at both ends and some to generate only for child of association. Ok I know I can customize the template, but I have no way to store any information inside EDMX editor where I can tell my code generator to skip generating specific navigation property for current class.

I wish there would be something in property pane or I can extend to add some more property in it.

Update: I know I can abuse documentation property, but I am thinking of some way where I can create Visual Studio Extension (write lots of code using VS SDK) and make it integrate with EDMX editor like we add attached properties in WPF.


Depending on how deep you want to go, you might find some pointers in this article, which uses the Entity Data Model Designer Extension Starter Kit.


See this article you can add whatever you want to the EDMX files ( its just xml ;) ). He adds an extension property myExtensions:Index so he can generate custom code to do indexing.


You could abuse the Documentation property. It is not used in the T4 template (not in the POCO template anyway) so you could put some directives in there.

0

精彩评论

暂无评论...
验证码 换一张
取 消