0

I have a .NET 5 WPF project, which connects to an another projects in the same solution. If I want to load any data from the DB, I get an error:

System.Data.Entity.Core.EntityException: 'The underlying provider failed on ConnectionString.' ArgumentException: Invalid value for key 'attachdbfilename'.

The connection string:

<add name="Booking_DatabaseEntities" 
     connectionString="metadata=res://*/Booking_Model.csdl|res://*/Booking_Model.ssdl|res://*/Booking_Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\Booking_Database.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient"/>

In the same solution there is a command line projects, which uses the same connection string, but it is working correctly and can use this DB.

Do you have any idea to solve this error?

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
Csaba
  • 1

0 Answers0