0

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
1
  • You have == after integrated security Commented Oct 13, 2017 at 14:25

1 Answer 1

1

There’s an extra equal sign after "integrated security".

answered Oct 13, 2017 at 14:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.