Ticket T190734
Visible to All Users

ModelDifferenceDbStore - Make it easier to store user settings in the database for WinForms and Web applications separately

created 10 years ago (modified 10 years ago)

Currently, you cannot easily create ModelDifference class descendants for Windows and the Web and have to implement the IModelDifference interface manually:
Saving model changes to the db separately for win vs web
Store Model Differences in DB - 14.2 - Possible to Separate Win/Web diffs?

I suggest adding the capability to pass a custom UserId when instantiating ModelDifferenceDbStore, e.g.:

C#
e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(MainDemo.Module.BusinessObjects.ModelDifferenceWeb), false, SecuritySystem.CurrentUserId + "Web");

This will add more flexibility for this task as well as allow developers to use custom identifiers for shared model differences instead of the empty string by default.

I also propose creating an index based on the UserId and GCRecord (E1484) properties with the DevExpress.Xpo.Indexed attribute (+ a solution for Entity Framework), because currently it is possible to have multiple records in the ModelDifference table with the same UserId value…

Comments (2)

    Hi Dennis,
    You've tickled my curiosity! Should we expect this in a minor, or major release?
    Thanks.
    Merry Christmas.

    Dennis Garavsky (DevExpress) 10 years ago

      Thanks for your interest, Denis. You will definitely receive a notification from us when this feature is available:-)
      Happy holidays to you and yours!

      Answers approved by DevExpress Support

      created 10 years ago (modified 10 years ago)

      We have implemented the functionality described in this ticket. It will be included in our next update(s).

      Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

      Additional information:

      The IModelDifference interface now declares the ContextID property.

      ContextId is the context identifier of the current Model Difference that allows distinguishing Model Differences designed for different applications using the same database. For example, you can use the "Win" identifier for the WinForms application and "Web" - for ASP.NET in order to store WinForms and ASP.NET model differences separately. You can pass the contextId parameter to the ModelDifferenceDbStore constructor to specify the current context when setting up the database storage for model differences:

      C#
      public sealed partial class MySolutionWindowsFormsModule : ModuleBase { private void Application_CreateCustomModelDifferenceStore(Object sender, CreateCustomModelDifferenceStoreEventArgs e) { e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), true, "Win"); e.Handled = true; } private void Application_CreateCustomUserModelDifferenceStore(Object sender, CreateCustomModelDifferenceStoreEventArgs e) { e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), false, "Win"); e.Handled = true; } //... public override void Setup(XafApplication application) { base.Setup(application); application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore; application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore; } }
        Comments (1)
        DevExpress Support Team 10 years ago

          See also:
          How to: Store the Application Model Differences in the Database
          IModelDifference.ContextId Property

          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.