Wanted to use SQL with EF6 in my Prism MVVM WPF App. Since I am new to EF6 I first made a simple sample that works just fine. In this sample I use one module and have 3 folders for Views, ViewModels and Models, the latter holding the SQL stuff.
So I translated the concept to my Prism App. Here I have a different structure. A 'Root' Module with the bootstrapper in the root and the MainShell and its Viewmodel in Views and ViewModels folders Respectively. I than have a folder Modules which holds 2 projects. in project 'Data' I have my EF logic in the 'SQL' folder. And in the project 'MainView' I have the MainView and the MainViewModel in the Folders 'Views' and 'ViewModels' respectively. Now when I compile I get the following message: 'No connection string named 'Entities01' could be found in the application config file'.
I then added the configuration string to the configuration file (App.config) in both the 'Root' Module and the 'MainView' Module. I also updated the paths to reflect the new location. But I now get a different error message.
System.Data.Entity.Core.MetadataException: 'The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource.'
To me this indicates that I did not change the path correctly.
Original (as created by EF6) connection string as follows:
<connectionStrings>
<add name="Entities01" connectionString="metadata=res://*/SQL.DB01.csdl|res://*/SQL.DB01.ssdl|res://*/SQL.DB01.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-14K5J6E\DB01;initial catalog=NLTrader01;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
I than modified the above code to the following to reflect the new location:
<connectionStrings>
<add name="Entities01" connectionString="metadata=res://*/Data/SQL.DB01.csdl|res://*/Data/SQL.DB01.ssdl|res://*/Data/SQL.DB01.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-14K5J6E\DB01;initial catalog=NLTrader01;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
I am at a loss as how to fix this. Is my approach just wrong or did I just make a typo in the new path?
I did add the using directives. I have also added EF6 to all projects. And I also added a reference to the 'Data' Project.