Finally, I found solution to this.
When I install Entity Framework, EF places some default code in application’s config file. As below:
Problem Code:
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
Solution:
This was root of the problem I was facing. By default it was creating a local connection string for itself. I made following changes:
1.) Changed "LocalDbConnectionFactory" to "SqlConnectionFactory"
2.) Removed parameters tag completely.
So it should look like this:
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
solved Class Library (.Net Framework) not supporting Entity Framework