Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Microsoft Data Entity Framework with Microsoft MVC on Mono 2.4

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.

like image 264
Allen Avatar asked Aug 31 '09 20:08

Allen


People also ask

Can we use Entity Framework in MVC?

Right-click the Controllers folder in Solution Explorer, select Add, and then click New Scaffolded Item. In the Add Scaffold dialog box, select MVC 5 Controller with views, using Entity Framework, and then choose Add.

Is it OK to use entities for view models in ASP NET MVC?

You can't. You need to represent different contexts as different view models because validation on those models changes depending on the screen representation.


1 Answers

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 ! ! !

like image 71
Stefan Steiger Avatar answered Sep 19 '22 05:09

Stefan Steiger