Ticket T485124
Visible to All Users

DashboardObjectDataSource serializer fails to load a data source type when signed assemblies with a changed version are used

created 8 years ago (modified 8 years ago)

Hello,

we are using the new XAF data dashboards module and noticed that it is not possible to load data via the ObjectDataSource when the referenced type is in a signed assembly and the assembly version changed.

To reproduce this, start the attached demo and invoke the "Show Dashboard Designer" action: the "Object Data Source 1" shows the properties of the Invoice type and the chart shows some data (Screenshot 1.png).

Now change the version of the DashboardsModule1.Module project  (Screenshot 2.png): the "Object Data Source 1" shows no properties and the chart does not show any data (Screenshot 3.png).

Olaf

Show previous comments (5)

    Hello Dennis,
    I ended up with a solution similar to this - load a XmlDocument and process the nodes.
    Olaf

    Dennis Garavsky (DevExpress) 7 years ago

      Thanks for your update, Olaf.
      I must note that this is not final 'solution' and it has drawbacks, but for now this is the only automatic way we can offer. We are currently discussing better options with our Dashboards team. We will update your ticket once we have new information. If there are no reliable solutions at our end, we will consider describing this in the documentation for the dashboard and related modules.

      Dennis Garavsky (DevExpress) 7 years ago

        Olaf, I just wanted to inform you that we reactivated your ticket, which means that we are looking for a final solution. Please do not be confused by this. We also want to keep it public so that other Dashboard users are aware of this situation and current solutions.
        We will update your ticket once we have new information.

        Answers approved by DevExpress Support

        created 7 years ago (modified 6 years ago)

        We have researched the problem further and found that the aforementioned  solution with DevExpress.ExpressApp.Updating.ModuleUpdater has some drawbacks:

        1. It is necessary to update the database each time when the project with BO is built and the assembly version is changed.
        2. When several client applications (WinForms or ASP.NET) have different assembly versions, they will update the database each time after the start.

        We think that there is a better solution by handling the AppDomain.AssemblyResolve event:

        C#
        using System.Reflection; namespace MySolution.MainModule { public class MainModule : ModuleBase { static MainModule() { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { Assembly result = args.RequestingAssembly; if(result == null) { AssemblyName requestedAssemblyName = new AssemblyName(args.Name); if(requestedAssemblyName.Name == "MySolution.Module") { Type typeFromSignedAssembly = typeof(Contact); result = typeFromSignedAssembly.Assembly; } } return result; } }

        Using this approach, you don't need to update the dashboard definition and the types that are stored in the dashboard data sources, are resolved at runtime.
        Also, this event is raised only once for an assembly, not for each type or each dashboard (as when the DashboardLoaded event is handled).
        We think that this event handler is better to place in the end application code rather than in our application framework part for the performance and security reasons. Usually there are only a few assemblies with BO in the application, so it's better to control assembly resolving manually, then write some automatic search through loaded assemblies as it may negatively affect performance.

        What do you think about this approach compared to the original solution?

          Comments (2)

            Hello Sergey,
            I think one should not use different assembly versions to connect to one database. So the updater solution runs one time when a new assembly version is deployed. But in the end we use both solutions, so we are prepared for all contingencies.
            Olaf

            Dennis Garavsky (DevExpress) 7 years ago

              Thanks for your update, Olaf.

              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.