In my application I receive the following error:
The context cannot be used while the model is being created.
I\'m not sure what
Add DatabaseContext constructor with database catalog name.
public class DatabaseContext : DbContext {
public DbSet Products { get; set; }
public DatabaseContext() : base("ProjectCode") {}
}
Change entityframework config in app.config like this.
Add Annotations to Products class. Make sure your database has a "Products" table with tow fields "ProductId" and "ProductName".
class Products {
[Key]
public int ProductID { get; set; }
public string ProductName { get; set; }
}
If still error, try to change you project target framework to use .net framework 4.0.