Custom Data Adapter Service in 2016.3

Stimulsoft Reports.NET discussion
Post Reply
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Custom Data Adapter Service in 2016.3

Post by petrdivis »

Hi,

we updated the Stimulsoft dlls from 2013 to 2016.3 and our custom StiSqlAdapterService/StiSqlDatabase/StiUserSource is not working anymore. The list of tables is empty and we cannot choose any tables and columns.

I have looked into the Database connection projects (Stimulsoft.Report.SQLiteDatabase) from the past on the site, but it didn't help. Maybe I am overlooking something.

Thanks for your help

Petr

EDIT - Additional findings:

I have changed the StiSqlAdapterService to StiUserAdapterService and implemented GetDataAdapter in our CustomUserSource:

Code: Select all

public override StiDataAdapterService GetDataAdapter()
	    {
	        var svc = StiConfig.Services.GetService(typeof(CustomAdapterService)); //always null!
                return svc as StiDataAdapterService;
	    }
protected override string DataAdapterType
		{
			get
			{
				return "OurNamespace.CustomAdapterService";
			}
		}
Ahead when invoking the Designer I call

Code: Select all

StiConfig.Services.Add(new CustomAdapterService(options));
but GetService is empty, a also see no services at all.

When wiring manually the CustomAdapterService into GetDataAdapter, then at least adding datasource to DataBand works. But when the CustomDataSource is created by Stimulsoft dlls (e.g. Previewing the Report), the GetDataAdapter is null.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Custom Data Adapter Service in 2016.3

Post by Alex K. »

Hello,

In the last versions config was removed. Please try to use StiOptions:
StiOptions.Services.DataAdapters.Add()

Thank you.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: Custom Data Adapter Service in 2016.3

Post by petrdivis »

Thanks Aleksey!
Is there some place where I can read what changed and how to use it?

We also use StiConfig.LoadLocalization so I expect change to StiOptions.Localization.Load, correct?
We also register components (StiView,StiService) and Databases.

After adding StiOptions.Services.DataAdapters.Add(new CustomAdapterService(this));
The customDataSource.GetDataAdapter() still returns null.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: Custom Data Adapter Service in 2016.3

Post by petrdivis »

In the end, this custom override works.

Code: Select all

public override StiDataAdapterService GetDataAdapter()
{
  var svc = StiOptions.Services.DataAdapters.Find(x => x.GetType().FullName.Equals(typeof(CustomAdapterService).FullName));
  return svc;
}
Thanks!

Petr
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Custom Data Adapter Service in 2016.3

Post by Alex K. »

Hello

Ok.
Please let us know if you need any additional help.

Thank you.
Post Reply