Recently I have been playing with Entity Framework on Linux using Mono and my database server is MS SQL 2014. When I attempt to add an entity I receive the “System.Data.Entity.Core.ProviderIncompatibleException was thrown” exception and the following message was displayed:
An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application’s config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
So I did some further investigation online and found the following post on how to work around it:
So you have been using Entity Framework on Visual Studio and now you would like to code in Linux using Mono and still be able to use Entity Framework. Well this post will give you some basic steps to setup your SQL server and Mono project to get a simple database going.
Setting SQL Express
Before we can go any further we need to have Microsoft SQL Server Express installed on a Windows server. For my own setup I already have a virtual machine with Windows Server 2012 running and SQL Server Express 2014 installed. It’s up to you to choose own setup, and it doesn’t have to be the same as mine.
Create Your SimpleDatabase
Now we need to create our test database on SQL Server by running the following SQL statement on your script editor of choice:
CREATE DATABASE SimpleDatabase
Now you should have a brand spanking new database created and ready to be populated with data. (more…)
Since the recent release of Ubuntu 14.04 I was surprised to see a new version of MonoDevelop, so I wanted to try creating an ASP.NET MVC 3 (Razor) project but it failed and threw the following exception:
System.IO.FileNotFoundException:Could not find file "/usr/lib/monodevelop/AddIns/MonoDevelop.AspNet.Mvc/Templates/Common/Index.cshtml".File name:'/usr/lib/monodevelop/AddIns/MonoDevelop.AspNet.Mvc/Templates/Common/Index.cshtml'
So while searching on the Internet for hours I found the following solution and hope this will solve your problem too. (more…)