The type initializer for ‘System.Data.Entity.Internal.AppConfig’ threw an exception

I got this error after updating my Visual Studio 2015 project with new Nuget Packages. The login with SqlServerMembershipProvider would not work anymore after the update.

I tried to solve the issue by changing the defaultConnectionFactory as advised in Unfortunately it did not help.

Continue reading


Entity framework and SQL Server Views

I tried to find an answer to my question: Can I use SQL Server Views with the entity framework? How is this different from mapping normal database tables?

There were a ton of search results for this question, but barely a good, definitive answer. I save you the time, the answer is :

Yes, it’s possible.

No sample code as you access a SQL Server views exactly like a database table.

Hmm. With one difference, I declared the properties of the view read only, e.g.


public string Name {get; private set;}

Don’t know if that is necessary, but at least my code cannot even try to write to a view 🙂