Green

Sunday, October 6, 2013

creating database with "code first" in Entity Framework

Hello,

I would like to create database with "code first" approach in Entity Framework. However, even if I don't get any exceptions, database is not created. What may be the reason for that?

app.config

    providerName="System.Data.SqlClient"    connectionString="Server=.\SQLEXPRESS;Database=MT4Analyzer;Trusted_Connection=true;"/>Database.cs public class EntityData : DbContext    // DbContext required: C:\Program Files (x86)\Microsoft Web Tools\Packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll    public List EntityStringColumns { get; set; }    public List EntityDoubleColumns { get; set; }        EntityStringColumns = new List();        EntityDoubleColumns = new List();TheOtherFile.cs // Here currentDBRow has all values that I want to add to DB.    var result = db.SaveChanges();Variable 'result' has value 0 and database is not created. I can log to SQL Server with Management Studio as current user or as "sa" (however "sa" requires password) because "Mixed Mode" is enabled.

Regards!


View the original article here

0 comments:

Post a Comment