Reputation: 1156
I'm using Npgsql with EF core to establish a connection to PostgreSQL for a demo console application. But I'm getting an exception 'Format of the initialization string does not conform to specification starting at index 0'. I think this because of some issue with the connectionstring. Any help is appreciated.
Upvotes: 2
Views: 8204
Reputation: 1156
This should do fine:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql(@"Server=localhost;Port=5432;Database=dbname;User Id=Id;Password=password");
base.OnConfiguring(optionsBuilder);
}
Upvotes: 6