Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mono 3 with EF 6 - has anyone had any luck with it?

I'm trying to get a proof-of-concept application which uses Entity Framework 6 with Mono 3.0.6 - and after 2 days of trials I'm giving up. Is there any sample app around I can look at? I googled - no luck.

I was trying to use "EntityFramework.dll" library from mono/GAC - in this case the project even does not get to the main() function - I get IL exception before that.

I tried downloading EF6 alpha 3 from NuGet - but then project crashes during the execution:

System.NullReferenceException: Object reference not set to an instance of an object at System.Data.Entity.Core.SchemaObjectModel.EntityKeyElement.Validate () [0x00000] in <filename unknown>:0

at System.Data.Entity.DropCreateDatabaseIfModelChanges`1[MonoTest.EF.FooContext].InitializeDatabase (MonoTest.EF.FooContext context) [0x00000] in <filename unknown>:0

at System.Data.Entity.Internal.InternalContext+<>c__DisplayClassc`1[MonoTest.EF.FooContext].<CreateInitializationAction>b__b () [0x00000] in <filename unknown>:0

at System.Data.Entity.Internal.InternalContext.PerformInitializationAction (System.Action action) [0x00000] in <filename unknown>:0

at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization () [0x00000] in <filename unknown>:0

at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4 (System.Data.Entity.Internal.InternalContext c) [0x00000] in <filename unknown>:0

at System.Data.Entity.Internal.RetryAction`1[System.Data.Entity.Internal.InternalContext].PerformAction (System.Data.Entity.Internal.InternalContext input) [0x00000] in <filename unknown>:0

So I'm not sure what's going on. Mono team said EF is shipped as part of Mono half a year ago - has anyone used it yet?

I would appreciate any links or source codes or tips to get this thing going.

Thanks!

like image 871
avs099 Avatar asked Apr 08 '13 15:04

avs099


1 Answers

I believe this is a bug in EF. I tried EF6 + Mono this and hit a NullReferenceException in the very same method. I filed a bug for this. You may want to create a bootleg and fix the bug on your own until it is fixed in the product - I described how to do that in the post.

like image 200
Pawel Avatar answered Nov 09 '22 22:11

Pawel