v4.0 Retrieval Procedures Does Not Use Adapter

Posts   
 
    
Kodiak
User
Posts: 92
Joined: 13-Apr-2009
# Posted on: 29-Sep-2013 11:10:33   

Hi,

I'm using Retrieval Stored Procedures with Adapter and found that the following does not work as expected:


var jobTypeData = new JobSummaryByJobTypeResultTypedView();
adapter.FetchTypedView(jobTypeData, RetrievalProcedures.GetQueryForJobSummaryByJobTypeResultTypedView(startDate, endDate));

I was expecting this to use the database from the adapter but after some SQL tracing found it is using the original database from which the LLBLGen project was generated. I would have thought that the instantiated adapter was doing the work and that the sproc would be executed in that database.

I had to work around with the following:


var jobTypeData = new JobSummaryByJobTypeResultTypedView();
var dataTable = RetrievalProcedures.UspJobSummaryByJobType(startDate, endDate, adapter);
jobTypeData.Load(dataTable.CreateDataReader());

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Sep-2013 20:25:02   

Do you have more than one schema and/or catalog in your solution?

Is the original database on a different server than the target database?

Does the target database have a different catalog name or schema name than the original one?

Kodiak
User
Posts: 92
Joined: 13-Apr-2009
# Posted on: 30-Sep-2013 04:34:56   

Hi Walaa,

In answer to your queries - I have a number of databases - each a copy of the original used to create the LLBLGen project.

All databases are identical.

All databases are stored on the same SQL instance (in this case - over time some may be split onto separate servers).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 30-Sep-2013 11:39:02   

Do:


var jobTypeData = new JobSummaryByJobTypeResultTypedView();
var query = RetrievalProcedures.GetQueryForJobSummaryByJobTypeResultTypedView(startDate, endDate);
query.NoNameOverwriting = false;
adapter.FetchTypedView(jobTypeData, query);

The GetQueryFor... method uses a new adapter instance to create the proc name. It sets NoNameOverwriting to true to signal users of the query not to do another name overwriting action again, however you want to do another name overwriting action, because your overwriting actions are in the adapter which executes the query.

Frans Bouma | Lead developer LLBLGen Pro
Kodiak
User
Posts: 92
Joined: 13-Apr-2009
# Posted on: 10-Oct-2013 05:32:32   

Excellent - thanks for the detailed explanation Frans! simple_smile