I have two projects in myVS 2015 solution.
Project A
Project B
My idea behind the above project structure is:
To reduce the complexity when project grows larger
To make it less complex & increase the readability
To make Authentication & Authorization logic in Project A
I have to achieve following thing in Project B:
Problem:
I have enabled code first migration and updated the DB. I'ts running without any issues but its not running against the database configured in web.config of Project A. Instead, its add its own local database.
Should I specify connection string in Project B as well. If yes, as its a class library how can I add a config file?
You need to specify your connection string in App.Config and then give the name of Connection string in Constructor of DbContext Like this.
public ApplicationContext() : Base('ConnectionString')
Also you need to change your defaultConnectionFactory from LocalDbConnectionFactory to SQLConnectionDbFactory in App.Config.