Ticket T474899
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

RuleFromBoolProperty not working

Cannot override DBContext.Savechanges

created 8 years ago

For troubleshooting purposes I wanted to put a break on DBContext.SaveChanges

Using the code I uploaded in 474659

I put inside T474565DbContext

C#
public override int SaveChanges() { Console.WriteLine("Saving"); throw new Exception("Cant save"); return base.SaveChanges(); }

I was surprised that this does not get called when I click Save Changes.

Am I missing something?

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello Kirsten,
We use DBContext to create an ObjectContext instance and use it in XAF. That is why the DBContext.SaveChanges method is not invoked. See EFObjectSpace.
 As far as I understand, you want to use this method to perform validation because the RuleFromBoolProperty not working approach is not working on your side.
We will research your implementation and answer you in the RuleFromBoolProperty not working thread.
Please describe your scenario in greater detail if you want to use the DBContext.SaveChanges method for another task. We will be happy to help you.

    Show previous comments (7)
    Dennis Garavsky (DevExpress) 8 years ago

      OK, let us know how it all goes.
      As for your new question about security, please submit a separate ticket using the https://www.devexpress.com/Support/Center/Question/Create service (because we are now far from the original topic and mixing everything here is not a good thing) and describe your reasons for this move and exactly how you want to do this, because this is not 100% clear at the moment. We will be more than happy to suggest you the best technical solutions to your issue.

        Oops, sorry Dennis, I had meant to make this comment at https://www.devexpress.com/Support/Center/Question/Details/T486359

        Should I continue there , or create a new question?

        Dennis Garavsky (DevExpress) 8 years ago

          Yes, I would create a new ticket for your new security-related question. Thanks for your cooperation.

          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.