Ticket T183754
Visible to All Users
Duplicate

Store Model Differences in DB - 14.2 - Possible to Separate Win/Web diffs?

created 10 years ago

Hi…

I've migrated my XAF app to 14.2 and ditched my version of this functionality, which was based on an old example you guys have up here somewhere.

This new module works well but when I log into the web version of my app it will save model changes that completely screw up the Windows version.

How could I modify your module to keep aspects for each user, and only load the appropriate one?

Thanks.

Answers approved by DevExpress Support

created 10 years ago

Hello Denis,

> Seeing as I have this code on both platforms, I should be able to either disable it on the web side, or create my own descendants and that should prevent it from screwing up the windows side?

You are correct. Disable this feature in either of the platforms: win or web.
Also, you can define an alternative implementation of the IModelDifference and IModelDifferenceAspect interfaces for the win or web platform. I will be happy to assist you if you have any difficulties with this.

    created 10 years ago

    Hello Denis,

    Unfortunately the "Model Differences in DB" feature does not support your scenario at the moment. In other words, the model differences which are actual only for win-platform, will be ignored and cleared by a web-application, and vice-versa. For this reason, "Model Differences in DB" feature is enabled by default only in the Win-application in the new solution created by XAF Solution Wizard.
    We have plans to improve this feature regarding the described scenario in future releases. As a temporary solution you can create two different users for the cases when one person works with both win and web applications.

    I hope you will find this answer helpful. If you have any difficulties with this, I will be happy to assist you further.

      Comments (3)

        Hi Aleks,
        I had hoped it would be on both platforms, but I understand. Seeing as I have this code on both platforms, I should be able to either disable it on the web side, or create my own descendants and that should prevent it from screwing up the windows side?
        It's one thing to ignore the differences, and quite another to clear them, or to change them. It shouldn't be that way.

        public override void Setup(XafApplication application)
               {
                   base.Setup(application);
                   application.CreateCustomModelDifferenceStore += application_CreateCustomModelDifferenceStore;
                   application.CreateCustomUserModelDifferenceStore += application_CreateCustomUserModelDifferenceStore;
                   // Manage various aspects of the application UI and behavior at the module level.
               }
               void application_CreateCustomModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e)
               {
                   e.Store = new ModelDifferenceDbStore((XafApplication)sender, true);
                   e.Handled = true;
               }
               void application_CreateCustomUserModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e)
               {
                   e.Store = new ModelDifferenceDbStore((XafApplication)sender, false);
                   e.Handled = true;
               }

          Hi Aleks,
          The way I see this, we would need to create a descendant of the ModelDifference and ModelDifferenceAspect. The latter would have a new field which specifies the target platform, in this case only two Windows and Web.
          So the ModelDifference object would normally contain two Aspects, one for each platform.
          Then we need to override the appropriate controllers to tell them to use these new data types, and over ride the OnSave, OnLoad, and OnCreate methods. (I'm guessing their names.)
          Am I missing something, conceptually??

          Aleksei M. (DevExpress) 10 years ago

            Hello Denis,

            I have checked the system where different classes are used for the win and web platforms. In other words, the ModelDifference1 and ModelDifferenceAspect1 classes are used for a win-application, the ModelDifference2 and ModelDifferenceAspect2 classes are used for a web-application. It looks like the system works correctly in such a configuration.
            I have not checked the system described by you. Though, conceptually, you are close to a right decision. The ModelDifference class can have two lists of aspects. Also, the Load and SaveDifference methods should be overwritten in your ModelDifferenceDbStore class descendant.

            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.