Page 1 of 1

Custom Data Adapter Service in 2016.3

Posted: Thu Mar 23, 2017 7:35 am
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.

Re: Custom Data Adapter Service in 2016.3

Posted: Thu Mar 23, 2017 10:57 pm
by Alex K.
Hello,

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

Thank you.

Re: Custom Data Adapter Service in 2016.3

Posted: Fri Mar 24, 2017 10:22 am
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.

Re: Custom Data Adapter Service in 2016.3

Posted: Fri Mar 24, 2017 12:02 pm
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

Re: Custom Data Adapter Service in 2016.3

Posted: Fri Mar 24, 2017 12:11 pm
by Alex K.
Hello

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

Thank you.