Reputation: 171
I'm trying to make a WPF desktop application that communicates with a database through EntityFramework. I've separated my solution into several projects: DTO, DAL, Service and WPFApp. I've set up my database context and repositories in the DAL project and I'm using the WPFApp as startup. Because of this, I'm getting an error when trying to add objects to my db: 'Format of the initialization string does not conform to specification starting at index 0.'
Do I have to set up my DbContext and ConnectionString in the Startup Project or is there another way to make this work?
Upvotes: 0
Views: 651
Reputation: 12276
When you add an entity framework database first model in a project there's a checkbox on the connection screen and it says something like add connection string to app.config.
All your stuff the connection depends on then appears in that particular project's own config.
These aren't the configs you're looking for.
Or at least not the config the exe will look in when your dll is loaded and runs in it's context.
Simplest fix:
Copy all the connection stuff out your project config into the main solution's config.
Upvotes: 1