Ticket T385436
Visible to All Users

How to access EF's DbContext from EFObjectSpace

created 9 years ago (modified 9 years ago)

Hi,

is there a possibility to access the instance of DbContext that ObjectSpace uses internally? I know how to access the ObjectContext, but I need functionality Microsoft introduced for DbContext particularly.

Regards,
Sebastian

Comments (3)
DevExpress Support Team 9 years ago

    Hi Sebastian,

    EFObjectSpace does not expose a DbContext instance, but there might be a way to access it. I am going to discuss your question with our developers, but need to clarify your requirements first. Perhaps, we can suggest an alternative way of fullfilling them. Please describe which DbContext functionality you want to use and why. This information will help us to provide you with the most appropriate solution.

    SM SM
    Sebastian Merli 9 years ago

      Hi Uriah,

      I think that is already the answer that I needed! If there is no easy way to access it, I can probably always use DbContext's ctr accepting an ObjectContext. So that's fine.

      Cheers
      Sebastian

      DevExpress Support Team 9 years ago

        Hi Sebastian,

        This is a nice and working approach. I also found that a similar question was answered on StackOverflow. Since this information might be helpful to others, I have changed the subject heading of this ticket and described the approach you are suggesting in the Solution section.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        According to this MSDN article, it is possible to create a DbContext instance wrapping an existing ObjectContext. This makes it possible to take advantage of DbContext features in an XAF application. The implementation details were discussed in this thread: How do I construct a DbContext from an ObjectContext.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.