CodeFirst : not support adding a constraint
Posted: Thu 21 Nov 2013 13:10
Hello,
I just started a new project and I evaluate the code first approach with Sqlite.
I managed to create my tables to save data and read it with your provider : good !
So I go to step 2 : have a relationship between two tables.
And here is my problem : SQLite does not support adding a constraint.
Error happen when I use the Add-Migration command
My sample code :
And the stack :
What did I do wrong?
Thanks
I just started a new project and I evaluate the code first approach with Sqlite.
I managed to create my tables to save data and read it with your provider : good !
So I go to step 2 : have a relationship between two tables.
And here is my problem : SQLite does not support adding a constraint.
Error happen when I use the Add-Migration command
My sample code :
Code: Select all
public class BaseLocaleContext : DbContext
{
public DbSet<Article> Articles { get; set; }
public DbSet<Groupe> Groupes { get; set; }
}
public class Article
{
public int Id { get; set; }
public string Reference { get; set; }
public int GroupeId { get; set; }
public Groupe Groupe { get; set; }
}
public class Groupe
{
public int Id { get; set; }
public string Nom { get; set; }
}
Sqlite seem to support FK : http://www.sqlite.org/foreignkeys.htmlApplying explicit migration: 201311211250531_AddGroupe.
System.NotSupportedException: SQLite does not support adding a constraint.
à Devart.Data.SQLite.Entity.x.a(be A_0)
à Devart.Common.Entity.be.a(a2 A_0)
à Devart.Common.Entity.k.a(List`1 A_0)
à Devart.Common.Entity.Migrations.a.a(IEnumerable`1 A_0, String A_1)
à Devart.Data.SQLite.Entity.Migrations.SQLiteEntityMigrationSqlGenerator.Generate(IEnumerable`1 migrationOperations, String providerManifestToken)
à System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList`1 operations, String migrationId)
à System.Data.Entity.Migrations.Infrastructure.MigratorBase.GenerateStatements(IList`1 operations, String migrationId)
à System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, XDocument targetModel, IEnumerable`1 operations, IEnumerable`1 systemOperations, Boolean downgrading, Boolean auto)
à System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
à System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
à System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
à System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
à System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
à System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b()
à System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
à System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
à System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
à System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
à System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
à System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
à System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
à System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
à System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
à System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
à System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
What did I do wrong?
Thanks