简体   繁体   English

实体框架5部分类不起作用

[英]Entity Framework 5 partial classes not working

I am using EF 5 and I have generated my model from a database. 我正在使用EF 5,我从数据库生成了我的模型。 I then want to create some partial classes to extend the functionality of the EF generated classes. 然后,我想创建一些部分类来扩展EF生成的类的功能。 In EF 4 I used to simply be able to Put the namespace of the I wanted to use for these classes in to the "Custom Tool Namespace" property of the edmx file. 在EF 4中,我曾经只是能够将我想要用于这些类的命名空间放入edmx文件的“自定义工具命名空间”属性中。 However in EF 5 this seems to be ignored. 但是在EF 5中,这似乎被忽略了。 No matter what I put in the "Custom Tool Namespace" it just keeps generating the the EF classes in the default namespace! 无论我放在“自定义工具命名空间”中,它只是在默认命名空间中生成EF类! I can obviously change the namespace of my partial classes, but I would rather be able to use my own namespaces for them. 我显然可以更改我的部分类的命名空间,但我宁愿能够使用我自己的命名空间。 How on earth do I do this in EF5? 我怎么在EF5中这样做?

在模式下的模型设计器属性(.edmx)中有一个名称空间属性,您可以在此处设置名称空间。

尝试打开edmx文件(在设计器中),右键单击设计器的表面并选择属性 - 您可以选择在那里设置命名空间,我相信这是EF5现在使用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM