4

我有一个现有的数据库,其中有几个不同数据库模式中的表。不同架构中的一些表具有相同的名称,因此我可能在架构 a 和架构 b 中有一个用户表。我可以在我的单个 .edmx 文件中创建两个图表并将命名空间映射到不同的图表,但我的 t4 模板只生成一个实体。

这种情况在实体框架中通常如何处理?有没有办法在生成实体时指定命名空间?

4

1 回答 1

0

Seems no, if you add all schemas in same .edmx mdoel.

Try to add another .edmx file in another folder or project, add tables of other schema to it and then go through the following:

1) From the solution explorer window, right-click on model.tt file and choose Properties.

2) In prop. window set the Custom Tool Namespace property to the desired namespace.

3) And finally, right-click on model.tt again and click on run custom tool.

After that, you'll see that the namespace of your model.tt POCOs are changed.

于 2013-08-11T11:47:04.580 回答