New Posts New Posts RSS Feed: EF repository and EFContextProvider
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EF repository and EFContextProvider

 Post Reply Post Reply
Author
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 Topic: EF repository and EFContextProvider
    Posted: 25-Sep-2012 at 3:05pm
The latest releases 0.57 and higher no longer require a connection string name to be passed to the EFContextProvider.  As per the suggestion, the connection information is now retrieved from the ObjectContext or DbContext directly. 
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:01pm
We will try to make this more configurable before the next release. 
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:23am
I noticed that for Metadata is required a ConnectionStrings from which breeze finds the .cdsl (I examined the source.) while for the effective database use I was able to pass a runtime context like this : (i am using DB first and objectcontext)
Public Class myController
    Inherits ApiController
    Implements IReadOnlySessionState

    Private contextProvider As Breeze.WebApi.EFContextProvider(Of mydb.myEntities)

    <AcceptVerbs("GET")> _
    Public Function Metadata() As String
        Return contextProvider.Metadata  ' not working at run time without connectionstring
    End Function

    <AcceptVerbs("GET")> _
    Public Function GetConfig() As IQueryable(Of mydb.MY_CONFIG)
        Return contextProvider.Context.MY_CONFIG  ' working at run time
    End Function

I hope that in a next release they will be able to implement for the metadata the possibility to retrieve the .cdsl from the connection string of the run time context instead of using the costant in web.config.
Otherwise is not difficul to modify the source code.

Piero
Back to Top
rdorris View Drop Down
Newbie
Newbie
Avatar

Joined: 18-Sep-2012
Location: United States
Posts: 1
Post Options Post Options   Quote rdorris Quote  Post ReplyReply Direct Link To This Post Posted: 18-Sep-2012 at 4:00pm
I'm using a repository pattern with EF and I'd like to try out using Breeze. How can I create an EFContextProvider without passing it a connection string? Is there a way to use an already opened dbcontext?

Thanks,
Rick
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down