New Posts New Posts RSS Feed: Test with objectcontext
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Test with objectcontext

 Post Reply Post Reply
Author
pierom View Drop Down
Newbie
Newbie


Joined: 19-Sep-2012
Location: Italia
Posts: 9
Post Options Post Options   Quote pierom Quote  Post ReplyReply Direct Link To This Post Topic: Test with objectcontext
    Posted: 19-Sep-2012 at 1:40am
Following your documents I am testing breeze with a database first object context.
I reference entityframework 5.0 with target net 4.0 while the objectcontext is enclosed in a library with EF 4.0 dlls.
Running the metadata request from url I get the error: 

Public Class GareController
    Inherits ApiController

    Private contextProvider As Breeze.WebApi.EFContextProvider(Of dbGare.GAREEntities) = New Breeze.WebApi.EFContextProvider(Of dbGare.GAREEntities)("Gare")

    <AcceptVerbs("GET")> _
    Public Function Metadata() As String
        Return contextProvider.Metadata
    End Function

    <AcceptVerbs("GET")> _
    Public Function MA_PS2_CONFIG() As IQueryable(Of dbGare.MA_PS2_CONFIG)
        Return contextProvider.Context.MA_PS2_CONFIG
    End Function

    <AcceptVerbs("POST")> _
    Public Function SaveChanges(ByVal saveBundle As JObject) As SaveResult
        Return contextProvider.SaveChanges(saveBundle)
    End Function

End Class

The error is:
Could not load file or assembly 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


Back to Top
pierom View Drop Down
Newbie
Newbie


Joined: 19-Sep-2012
Location: Italia
Posts: 9
Post Options Post Options   Quote pierom Quote  Post ReplyReply Direct Link To This Post Posted: 19-Sep-2012 at 9:26am
An update:

From the Github source I noticed that webapi.dll is compiled against EF 4.3.1.
Using nuget I installed EF 4.3.1 and now it is working.
Back to Top
jtraband View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 19-Sep-2012
Posts: 55
Post Options Post Options   Quote jtraband Quote  Post ReplyReply Direct Link To This Post Posted: 19-Sep-2012 at 6:11pm
We are considering compiling the Breeze.WebApi with EF 5 ( actually EF 4.4 for .NET 4, but the nuget download actually makes it look like EF 5).  We need to also offer the 4.3.1 version because MS moved some of the DataAnnotations across namespaces between EF 4.31 and EF 4.4 and we don't want to break 'legacy' EF 4.3.1 apps.  So we will likely offer two versions of the Breeze.WebApi in one of our next releases.  Hope this helps.
Back to Top
rmja View Drop Down
Newbie
Newbie


Joined: 23-Sep-2012
Posts: 1
Post Options Post Options   Quote rmja Quote  Post ReplyReply Direct Link To This Post Posted: 23-Sep-2012 at 10:58am
If you:
  1. pull the source from github
  2. open it in VS2012
  3. change the .net target version to 4.5
  4. remove the entity framework from nuget
  5. install entity framework 5.0
  6. build
then you have a working dll for a 5.0 project.
Back to Top
jtraband View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 19-Sep-2012
Posts: 55
Post Options Post Options   Quote jtraband Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2012 at 1:05pm
Thanks, we fixed this in version 0.57 ( and higher).  The Breeze.webApi.dll as shipped is now compiled against EF 5 and .NET 4.0.  Note that the actual version of EF 5 for .NET 4 is actually "4.4", so this is what we are actually compiling against. 

If you are running .NET 4.5 this should still work but if you want you can recompile the Breeze.webApi project to use the .NET 4.5 version of EF 5 using the technique mentioned above.

We also documented this in "EF versions" section  of the docs at

 http://www.breezejs.com/documentation/web-api-configuration 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down