使用EF Power Tools 错误参数 80070057解决方法


错误参数。(异常来自 HRESULT:0x80070057 (E_INVALIDARG))

An error occurred while trying to instantiate the dbcontext type TestDB2Context see the output window for details

 

public class ProductContext : DbContext
 {
        public ProductContext()
            : base(@"Data Source=.;Initial Catalog=Product;Integrated Security=True")
        { }
  static ProductContext()
  { 
   Database.SetInitializer<ProductContext>(null);
  }

  public DbSet<Category> Categories { get; set; }
  public DbSet<Product> Products { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
   modelBuilder.Configurations.Add(new CategoryMap());
   modelBuilder.Configurations.Add(new ProductMap());
  }

 并且config文件中的仍然保留!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM