Instantiating a TypedView mapped onto a Stored Procedure Resultset is not using the PersistenceInfoProvider ElementFieldMappings

Posts   
 
    
Zaudio
User
Posts: 8
Joined: 04-Nov-2021
# Posted on: 04-Nov-2021 23:03:13   

Hi,

We are using version 5.7.3 still; but nothing in the 5.8 log suggests this is fixed.

Hopefully you can help me resolve this, or accept it as a bug.

I have a stored procedures that have resultset column names that include the _ character.

When reverse engineering these to typed views, those names are converted to Pascal Case, without the _'s. Also code generation produces in the PersistenceInfoProvider class a method to map that element and its fields. That code itself looks correct.

When I follow your guidelines at

https://www.llblgen.com/documentation/5.7/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/Using%20TypedViews,%20TypedLists%20and%20Dynamic%20Lists/gencode_usingtypedview_adapter.htm#instantiating-a-typedview-mapped-onto-a-stored-procedure-resultset

so code like this:

CustomersOnCountryTypedView customersTv = new CustomersOnCountryTypedView();
using(DataAccessAdapter adapter = new DataAccessAdapter())
{
    adapter.FetchTypedView(customersTv, RetrievalProcedures.GetQueryForCustomersOnCountryTypedView("USA"));
}

I do not get any data for any column where the stored procedure resultset column name does not precisely match the typed view filed name. I have verified that the PersistenceInfoProvider .InitPROCNAMEresultTypedViewMappings method is executed when I create my DataAdapter, and thus the mappings were added to the provider.

So it seems that the mappings are just not being used. Please advise how I can make this work? I also tested with simply renaming a type view field name that was being populated, appending a '2' to the end so it no longer matched the proc column name, and that also resulted in no data in that field. So the maps are not being applied.

The only workaround I can see for now is to alter all of our stored procedures we need to retrieve so that the mapped typed view field names would match the resultset column names; which of course totally defeats the point of mappings.

Thanks

Simon

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 05-Nov-2021 00:39:03   

Which database are you using ?

Also, could you please try v.5.8? This looks like an issue that was solved previously in 5.7.x, so just to be sure, please try v.5.8

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 05-Nov-2021 09:23:06   

Also please provide a small repro case to reproduce this issue. Thanks. (We have tests for this specific scenario which succeed, hence our question). Please also make sure you use the runtime libraries that contain the fix, so a version > 5.7.0

Frans Bouma | Lead developer LLBLGen Pro
Zaudio
User
Posts: 8
Joined: 04-Nov-2021
# Posted on: 05-Nov-2021 18:32:37   

Otis wrote:

Also please provide a small repro case to reproduce this issue. Thanks. (We have tests for this specific scenario which succeed, hence our question). Please also make sure you use the runtime libraries that contain the fix, so a version > 5.7.0

Hi Otis, We are using RTM 5.7.3 as stated above, so that should be sufficient according to your bug fixes? We are using MS Sql

I have prepared a repo case... attached.

Enclosed in the archive is a c# solution, the llblgen project file for the entities, and a sql script to create the test database. My sql server is 2014 in case that makes any difference, but I have compatibility mode set to 2012, per our actual application having this problem. All you need to do in the solution is edit the connectionstring in program.cs of the LlblgenTestConsole to be wherever you set up the database.

Executing the SelectFoo stored procedure in SSMS I get:

id Name_1 Name_2 Val_1 1 Jo Smith 12.250000000 2 Bob Green 9.730000000

The output from the test console is: Id:2, Name1:, Name2:, Val1:0.0

Thus demonstrating exactly the issue I have in application; the columns named with '_' and thus not matching the typedview field names exactly do not get any data; i.e. the mapping does not work.

Thanks again

Simon

Attachments
Filename File size Added on Approval
LlblGenTest.zip 30,226 05-Nov-2021 18:33.37 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 06-Nov-2021 10:10:52   

Thanks, we'll look into it!

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Nov-2021 10:02:19   

Your repro references 5.7.0, which contains the bug, it was fixed in 5.7.1:

Fix Runtime Libraries 5.7 5.7.1 17-Jun-2020 Additional fix for typed view mapped onto resultset with different names: names with underscores were no longer used in the projection. This fix corrects that

When I reference 5.7.3 from nuget (see the csproj files!) it works fine:

C:/Users/*******************/Downloads/LlblGenTest/LlblGenTest/bin/Debug/netcoreapp3.1/LlblGenTestConsole.exe
Id:1, Name1:Jo, Name2:Smith, Val1:12,250000000
Id:2, Name1:Bob, Name2:Green, Val1:9,730000000
Done
Frans Bouma | Lead developer LLBLGen Pro
Zaudio
User
Posts: 8
Joined: 04-Nov-2021
# Posted on: 08-Nov-2021 17:44:37   

Awesome, thanks Otis!

Clearly missed the nuget version; was so focused on the Llblgen RTM build version and project generation. This works now!

Thanks again

Simon

Otis wrote:

Your repro references 5.7.0, which contains the bug, it was fixed in 5.7.1:

Fix Runtime Libraries 5.7 5.7.1 17-Jun-2020 Additional fix for typed view mapped onto resultset with different names: names with underscores were no longer used in the projection. This fix corrects that

When I reference 5.7.3 from nuget (see the csproj files!) it works fine:

C:/Users/*******************/Downloads/LlblGenTest/LlblGenTest/bin/Debug/netcoreapp3.1/LlblGenTestConsole.exe
Id:1, Name1:Jo, Name2:Smith, Val1:12,250000000
Id:2, Name1:Bob, Name2:Green, Val1:9,730000000
Done