Custom dataprovider error

Posted by: marcelo on 25 January 2018, 2:08 pm EST

    • Post Options:
    • Link

    Posted 25 January 2018, 2:08 pm EST

    Hi.

    I’m creating a C#/ ASPx MVC application and trying to create a custom dataprovider.

    When I use the custom data provider with a desktop application, its works.

    But, when I try to use on C#/ ASPx MVC Application I receive the following error (see the attached image for details). The error occurs when I try to show the report using the WebViewer component.

    I already tried to register the custom data provider with a file called GrapeCity.ActiveReports.config

    try to register on web.config

    But the error still occurs.

    What I have to do to get my MVC Application working with my custom data provider? Or

    How can I register my custom data provider using C#/ASPX MVC application?

    Thanks and sorry for some english mistakes.

  • Posted 28 January 2018, 4:14 pm EST

    Hello,

    Could you please check after doing following things:

    1: Build your assembly with strong name private key.

    2: Specify right assembly version in Grapecity config file.

    3: Build data provider as “AnyCPU”.

    Thanks,

    Mohit

  • Posted 29 January 2018, 6:28 am EST

    Hi.

    I tried your suggestion, but it still not working.

    And when I register the data provider assembler with a strongest name, the desktop applications crashes too. So I revert that.

    I copy GrapeCity.ActiveReports.config file to views folder, root folder, but still not working.

    There is a way to register it programatically when report starts or even in global.asax?

    Or register in the web.config file?

    Here is my GrapeCity.ActiveReports.config

    <?xml version="1.0" encoding="utf-8" ?>
    <ReportingConfiguration>
      <Extensions>
        <Data>
          <Extension Name="ERPNet"
                  DisplayName="ERP.Net Data Provider"
                  Type="ERP.Net.Reports.DataProvider.DataProviderFactory,ERP.Net.Reports.DataProvider,version=0.0.0.1, Culture=neutral"
                  />
        </Data>
      </Extensions>
    </ReportingConfiguration>
    

    Thanks,

    Marcelo.

  • Posted 29 January 2018, 7:39 am EST

    Hi.

    I solved this using the interface IConfigurationProvider that I’ve found in documentation.

    Here is an example.

    class ConfigurationProvider : IConfigurationProvider
        {
            public string Content
            {
                get
                {
                    StringBuilder result = new StringBuilder();
    
                    result.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                    result.AppendLine("<ReportingConfiguration>");
                    result.AppendLine("  <Extensions>");
                    result.AppendLine("    <Data>");
                    result.AppendLine("      <Extension Name=\"ERPNet\"");
                    result.AppendLine("                 DisplayName=\"ERP.Net Data Provider\"");
                    result.AppendLine("                 Type=\"ERP.Net.Reports.DataProvider.DataProviderFactory,ERP.Net.Reports.DataProvider,version=0.0.0.1, Culture=neutral\"/>");
                    result.AppendLine("    </Data>");
                    result.AppendLine("  </Extensions>");
                    result.AppendLine("</ReportingConfiguration>");
    
                    return result.ToString();
                }
            }
        }
    

    And when I create the report, I set the report.ConfigurationProvider to my own configuration provider.

    var report = default(GrapeCity.ActiveReports.PageReport);
    
                using(var reader = new StringReader(HttpUtility.UrlDecode(reportDefinition.Model)))
                {
                    report = new GrapeCity.ActiveReports.PageReport(reader);
                }
    
                report.ConfigurationProvider = new ConfigurationProvider();
    
                ViewBag.Report = report;
    

    Thanks,

    Marcelo

  • Posted 29 January 2018, 9:04 pm EST

    Hello,

    I am glad that you had solved your problem. This is another way to add the config file to report. However, you can simply put the config file in your project to solve the problem. Also, I am unable to reproduce the issue at our end. Could you please recheck after set “Copyto output directory” of ‘Grapecity.ActiveReports.Config’ file to “Copyalways”.

    Hope it helps.

    Thanks,

    Mohit

  • Posted 29 January 2018, 10:51 pm EST

    I already had done that too :slight_smile:

    Thanks!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels