Answer the question
In order to leave comments, you need to log in
Why is the database not being created in Entity Framework (Code First)?
I create connection strings as indicated in the documentation, but for some reason, when I start the application, the database is not created
<connectionStrings>
<add name="ProductsContext" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=OnlineStoreParser1;AttachDBFilename=|DataDirectory|\OnlineStoreParser1.mdf;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace OnlineStoreParser.Models
{
public class ProductsContext : DbContext
{
public ProductsContext() : base("ProductsContext") { }
public DbSet<Product> Products { get; set; }
public DbSet<HistoryEntry> History { get; set; }
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question