使用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