I have a solution with multiple databases. We use EF6.
We have one project, which is EF6 (code first), and the first project is EF6 DB.
var arkleModelDbFist = new Arkle.DAL.EF.ArkleEntities();
var CustomerOld= new Arkle.DAL.EF.Customer();
arkleModelDbFist.Customers.Add(CustomerOld);
arkleModelDbFist.SaveChanges();
var arkleModelCodeFirst = new ArkleEfModel();
var customer= new customer_ef();
arkleModelCodeFirst.Customers.Add(customer);
arkleModelCodeFirst.SaveChanges();
We get the following error.
System.Data.Entity.Infrastructure.UnintentionalCodeFirstException was unhandled
Message = Context is used in Code First mode with the code that was generated from the EDMX file for the First or Model First database. This will not work correctly. To resolve this issue, do not delete the line of code that throws this exception. If you want to use Database First or Model First, make sure that the Entity Framework connection string is included in the app.config or web.config of the startup project. If you create your own DBConnection, then make sure that it is an EntityConnection, and not some other type of DbConnection, and that you pass it to one of the basic DbContext constructors that accept DBConnection. To learn more about Code First, Database First, and Model First, see the Entity Framework documentation here: http://go.microsoft.com/fwlink/?LinkId=394715
StackTrace: Arkle.DAL.EF.ArkleEntities.OnModelCreating(DbModelBuilder modelBuilder)
, ?