Trying to design simple code that generates DB:
namespace CodeFirstDemo
{
public class Post
{
public int Id { get; set; }
public DateTime DatePublished { get; set; }
public string Title { get; set; }
public string Body { get; set; }
}
public class BlogDbContext : DbContext
{
public DbSet<Post> Posts { get; set; }
}
class Program
{
static void Main(string[] args)
{
}
}
}
app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name ="BlogDbContext" connectionString ="data source=.\SQLEXPRESS; initial catalog=CodeFirstDemo; integrated security==SSPI" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
After I have performed enable-migrations
I got error:
Format of the initialization string does not conform to specification starting at index 57.
I suppose something is wrong with my connection string:
<add name ="BlogDbContext" connectionString ="data source=.\SQLEXPRESS; initial catalog=CodeFirstDemo; integrated security==SSPI" providerName="System.Data.SqlClient" />
But what exactly is wrong there?
asked Oct 13, 2017 at 14:21
-
You have == after integrated securitySean T– Sean T2017年10月13日 14:25:42 +00:00Commented Oct 13, 2017 at 14:25
1 Answer 1
There’s an extra equal sign after "integrated security".
lang-cs