I'm using Entity Framework 4.2 CF with SQLite, but when i try to launch the application i got "CreateDatabase is not supported by the provider" error. This is my model mapping:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
#region NewsMapping
modelBuilder.Entity<News>().ToTable("news");
modelBuilder.Entity<News>().HasKey(x => x.Id).Property(x => x.Id).HasColumnName("ID").HasColumnOrder(0);
modelBuilder.Entity<News>().Property(x => x.Status).HasColumnName("STATUS");
modelBuilder.Entity<News>().Property(x => x.NewsTitle).HasColumnName("NEWS_TITLE");
modelBuilder.Entity<News>().Property(x => x.Content).HasColumnName("CONTENT_1");
modelBuilder.Entity<News>().Property(x => x.IsImportant).HasColumnName("IS_IMPORTANT");
modelBuilder.Entity<News>().Property(x => x.OrderNumber).HasColumnName("ORDER_NUMBER");
modelBuilder.Entity<News>().Property(x => x.CreateDate).HasColumnName("CREATE_DATE");
#endregion
base.OnModelCreating(modelBuilder);
}
What is wrong in this code?
Thanks
Nothing is wrong in the code. The error says exactly what is going on. Your EF provider for SQLite (System.Data.SQLite
) doesn't provide database creation so you must create database and all tables manually before you launch the application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With