i want to create database and i use entity framework but when i run my wpf project, i take this error. This error appears for 2 tables. In here, my error:
using (var c = new RSPDbContext()) {
var s = from v in c.Users select v;
}
In RSPDbContext.cs, i generate my database.
public RSPDbContext()
: base("databaseName")
{
Database.SetInitializer<RSPDbContext>((IDatabaseInitializer<RSPDbContext>)new MigrateDatabaseToLatestVersion<RSPDbContext, RSP.Common.Migrations.Configuration>());
}
and Configuration.cs:
public Configuration()
{
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
}
In app.config:
<connectionStrings>
<add name="databaseName" connectionString="Data source=.\SQLExpress;Initial catalog=databaseName;Integrated Security=true; MultipleActiveResultSets=True;" providerName="System.Data.SQLClient" />
</connectionStrings>
In RSDPContext.cs, i can create smoothly when i eject this table:
public DbSet<tableName> tableNames { get; set; }
why i take this error ? any idea ? thanks in advance