Using Microsoft Data Entity Framework with Microsoft MVC on Mono 2.4

asp.net-mvc entity-framework mono

Question

I'm using Mono 2.4 on the Ubiquity web hosting service.

I created a simple MVC tutioal applciation, linked here, and verified that it worked using all Microsoft tools.

Next, the application was updated to point to a MySQL server database running on my Ubiquity host. The application works great on a Microsoft based machine.

Now, I am trying to deploy the application to the mono server on Ubiquity.

I set System.Web.MVC so it will CopyLocal=true.

I deployed the application to the mono server.


I get this error:

Description: Error parsing a resource required to service this request. Review your source file and modify it to fix this error.

Parser Error Message: Assembly System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 not found Version information: Mono Version: 2.0.50727.1433; ASP.NET Version: 2.0.50727.1433


I am guessing the problem could be...

A) The Entity framework is not supported in mono. I need to use something other than the Microsoft Data Entity Framework.

B) The public key token for the mono version of System.Data.Entity is not "b77a5c561934e089".

C) There is something else going on.


I tried setting CopyLocal=true for the System.Entity.Data dll. Thus, the Microsoft version of the DLL deployed to my mono server. I have doubts that this is legal. At any rate, that only produced the following error:

Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.


Question

Can somebody confirm that it is possible to use the Microsoft Entity Framework on Mono? I am probably going to migrate away from the Microsoft Entity Framework, per this comment in the Microsoft MVC tutorial linked above..

"The ASP.NET MVC framework is not tied to the Microsoft Entity Framework. You can create >your database model classes by taking advantage of a variety of Object Relational Mapping >(OR/M) tools including LINQ to SQL, Subsonic, and NHibernate."

However, for the sake of consistency, I would like to use the Microsoft Entity Framework on mono if that is possible.

Accepted Answer

You should set CopyLocal = true for the System.Data.Entity assembly as well. You noted that you copied System.Web.MVC local, but never mentioned that you copied System.Data.Entity locally. You might also need to copy local any of the assemblies that System.Data.Entity depends upon that are not part of Mono.


Popular Answer

I can confirm that EntityFramework, Microsoft Chart Controls, and Microsoft Sync Framework do NOT work on mono on Linux, despite different claims from Microsoft and/or MS-employees.

That is because Sync Framwork uses pinvoke with a COM interop component, Microsoft Chart Controls has DirectorySeparator issues, and the EntityFramwork namespace is not ported to mono, yet.
So note that when Microsoft says "works with mono", they mean "with mono on Windows".

It is estimated that the EntityFramwork port will take 1 year at least, until it reaches alpha/beta stage, that is, if somebody would decide to do that.

But there are no official plans to port EntityFramework.

EntityFramwork might work/s on the windows version of mono, as long as you set localcopy to true.

I advise you to use nhibernate instead.

Update:

As of Mono 2.11.3, Microsoft has open sourced EntityFramework.
Hence, it is now a part of Mono's distribution.
This version comes with 349 commits, with around 514 file changes.
It includes 15553 insertions and 3717 deletions.

Two down, one to go.
I guess this means:

BIG THANKS TO MICROSOFT, THAT 'S TERRIFIC ! ! !



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why