LLBLGEN 4.2 fethtypedlist problem

Posts   
 
    
PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 13-Apr-2017 18:08:51   

Hi We are using llblgen 2.5. We created llblgen 4.2 Project. We eant to convert llblgen 2.5 Projects to 4.2 projects. But we have an other problem

Suppose we defined a dataset at .net c# and add 2 fields into dataset such as SAHA1 and SAHA2.

After using fetchtypedlist llblgen 4.2 does not add other fields into my dataset, it overwrites Orgfirma value into SAHA1 field and Sahizmethodu field into SAHA2 field, Tanimi field , Prabirimi field, birimkodu field automatically added to my dataset.

**LLBLGEN 4.2 My dataset fields are like this after fetchtypedlist **

SAHA1 SAHA2 Tanimi ParaBirimi BirimKodu

My dataset fields are erased.

LLBLGEN 2.5 My dataset fields are like this after fetchtypedlist

SAHA1 SAHA2 OrgFirmaKodu SaHizmetKodu Tanimi ParaBirimi BirimKodu

How can I solve this problem at llblgen 4.2.?

=====================================================

        ResultsetFields fields = new ResultsetFields(5);
        fields.DefineField(SaHizmetKartiFields.OrgFirmaKodu, 0);
        fields.DefineField(SaHizmetKartiFields.SaHizmetKodu, 1);
        fields.DefineField(SaHizmetKartiFields.Tanimi, 2);
        fields.DefineField(SaHizmetKartiFields.ParaBirimi, 3);
        fields.DefineField(SaHizmetKartiFields.BirimKodu, 4);

        PredicateExpression filter = new PredicateExpression();
        filter.Add(SaHizmetKartiFields.OrgFirmaKodu == 1);
        //   filter.Add(SaHizmetKartiFields.MasrafTipKodu == (decimal)3);
        IRelationPredicateBucket rpb = new RelationPredicateBucket(filter);

        try
        {
            if (dtSaHizmet.Rows.Count > 0) dtSaHizmet.Rows.Clear();
            _adapter.FetchTypedList(fields, dtSaHizmet, rpb);
        }
        catch (System.Exception eSys)
        {
            MessageBox.Show(eSys.Message);
        }
Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-Apr-2017 10:14:18   

Please try projection as in the example here:

Projecting Dynamic List resultset onto custom classes

This should match properties by name and won't override other properties.

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 14-Apr-2017 10:38:29   

In this case, I have to change parameters.Because I used FetchTypedList in my projects. FetchTypedList parameters and FetchProjection parameters are different. So I have to change all of the programcodes that using FetchTypedList.

So I need an other solution for this problem.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-Apr-2017 11:21:52   

The other solution would be to define the extra fields/DataColumns after fetching the typedList into the dataTable.

Or merge 2 dataTables.

Would this work?

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 14-Apr-2017 11:38:17   

We know this solution. But it is not possible to review all of our program codes.

How can we find the codes at this situation.? If we can not find datasets and not change out codes like this, new llblgen dll will owerwrite into our dataset.

Is there any other solution?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 15-Apr-2017 10:07:23   

Please provide a repro case which illustrates the problem as it's unclear to me what exactly you are doing and what is wrong. Thus specify clearly what you expect should happen and what happens instead and code which illustrates that. Your code snippet in the start post is unclear to me why that would create a problem.

Frans Bouma | Lead developer LLBLGen Pro
PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 16-Apr-2017 11:03:52   

There are some projects contains some extra fields created at design time apart from table fields(not table fields). So that when I use llblgen 4.2, fetchtypedlist overwrites into my fields (for my first message saha1 and saha2) , but llblgen 2.5 add table fields as extra fields and not overwrites into my extra fields(SAHA1 -SAHA2).

I think, LLblgen 4.2 should cover all the possibilites of llblgen 2.5. But we show that llblgen 4.2 behaving differently from lllblgen 2.5. So this is a problem for us.

LLBLGEN 4.2 EXAMPLE

visual studio, I create a dataset (named DATASET1) at design time, add 2 fields SAHA1 and SAHA2 at design time. My database table(TABLE1) does not contain SAHA1 and SAHA2 fields.

Suppose TABLE1 fields are OrgFirmaKodu, SaHizmetKodu, SaHizmetAdı.

After fectypedlist TABLE1 into DATASET1 at runtime , my table TABLE1 contains fields(at runtime-debug) like this. SAHA1, SAHA2, SaHizmetAdi.

OrgFirmaKodu, SaHizmetKodu fields are overwiten into my SAHA1 and SAHA2 fields. LLBLGEN 2.5. does not work like this.

I have lots of projects, .Because I dont know the projects that are added extra fields at design time.

Is it clear?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 16-Apr-2017 11:20:45   

No this isn't clear, sorry. Please provide a repro case for v4.2 which illustrates your point. I now don't know what is wrong and what you do expect it should do. I can then try to find the situation you're in with trial/error but that might not be the situation you're facing.

v4.2 does what v2.5 does with the differences documented in the 'migrating your code' documentation. It can be we changed somethings along the way, v2.5 is from 2007, 10 years old, so it might be some things changed. That doesn't mean what you want to do isn't supported, I just don't know exactly what you want to do.

So please provide a simple repro case which shows what you are trying to do and where fields are overwritten, so we can have a look why this is and advice you what to do to work around that.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 17-Apr-2017 10:34:38   

Looking at the code in v4.2, the problem I think is regarding the columns OrgFirmaKodu and SaHizmetKodu. These aren't present in the DataTable passed to FetchTypedList, and our own datatable filler doesn't create new columns, it reuses existing ones. So it fetches the data in the SAHA1 and SAHA2 columns instead.

To solve this, add the columns OrgFirmaKodu and SaHizmetKodu to the typed dataset, before fetching.

Frans Bouma | Lead developer LLBLGen Pro
PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 24-Apr-2017 08:05:31   

I think that, if llblgen 4.2 doesn not find OrgfirmaKodu and Sahizmetkodu fields, It should create new fields as OrgfirmaKodu and Sahizmetkodu, and should not overwrite into SAHA1 and SAHA2. It means that, llblgen 4.2. does not support llblgen 2.5 features. Is it true?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 24-Apr-2017 09:33:23   

PAZIMLI wrote:

I think that, if llblgen 4.2 doesn not find OrgfirmaKodu and Sahizmetkodu fields, It should create new fields as OrgfirmaKodu and Sahizmetkodu, and should not overwrite into SAHA1 and SAHA2. It means that, llblgen 4.2. does not support llblgen 2.5 features. Is it true?

Did you read my reply? As it would answer your question.

It does support v2.5's features but it also has to support other features, namely a typed view on a stored proc resultset, which means it can't create new columns if there are already columns in the datatable, as it would break that feature. So it doesn't create new datatable columns if there are already datatable columns and instead re-uses them based on ordinal in the resultset.

As I said: to fix your problem, all you have to do is make sure the columns in your resultset are present in your datatable passed to the method.

Anyway, if you want to bicker over whether v4.2 does or doesn't support 2.5's features, then we're done here. disappointed As in v2.5, it simply used the DbDataAdapter to fill the datatable, but that wouldn't work with typeconverters and would be brittle for stored proc resultset mappings, hence we used our own since then. Which creates only columns when there are no columns in the datatable. It wasn't a documented supported feature that it automatically would create missing columns, it was a side effect of the usage of DbDataAdapter.

Frans Bouma | Lead developer LLBLGen Pro