我有几个模块的Web应用程序。其中一个名为“系统”。
当我在另一个模块中创建迁移时,EF会将必要的使用添加到namespace
范围中。
namespace MaxPatient.Modules.Appointments.Migrations
{
using System.Data.Entity.Migrations;
我知道在这种情况下,编译器会认为是root的路径MaxPatient.Modules
,并且抛出错误
The type or namespace name 'Data' does not exist in the namespace 'MaxPatient.Modules.System' (are you missing an assembly reference?)
EF自动生成的文件会出现同样的问题
namespace MaxPatient.Modules.Appointments.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.0.1-21010")]
public sealed partial class AlterResponseTable : IMigrationMetadata
问题通过复制/粘贴
解决using System.Data.Entity.Migrations;
namespace MaxPatient.Modules.Appointments.Migrations
{
但我有太多文件,想找到更漂亮的解决方案。
我不知道,如何对EF说,它是在命名空间范围之外创建的。
可能有人面临类似的问题吗?
谢谢:)