SaveEntityCollection 5.4.3 vs 5.5

Posts   
 
    
Findev
User
Posts: 103
Joined: 08-Dec-2014
# Posted on: 04-Nov-2018 12:37:14   

Hi,

I think the return value (affected records) is now calculated differently for the SaveEntityCollection method. I have inheritance, say, Base (mapped to table Base) and Inherited (mapped to Inherited table). Direct and inherited properties of the Inherited entity instance are modified and then save is invoked. Return value is expected to be 1. Underneath it will have to do 2+ SQL queries of course. I was under assumption that affected records is the number of "entities" passed to the save method rather than the actual SQL records affected given the behaviour I've observed for years. However, after upgrading to 5.5 the method returns 2 instead of 1. It seems it can return 1 if Inherited entity instance properties are not modified.

Thus the question: is that a regression or... db count value is being returned directly now? simple_smile

Thank you!

Following LinqPad snippet outputs 1 with 5.4.3 and 2 with 5.5. If direct property is commented out then prints 1 with 5.5.


void Main()
{
    using (var ts = new System.Transactions.TransactionScope())
    {
        var pv = new XXXEntity(Guid.Parse("C72A7FA0-9672-4A31-A671-7D3571A5696D"));
        pv.IsNew = false;
        pv.Description = "1"; // inherited property
        pv.DateUsableUntil = DateTimeOffset.UtcNow; // direct property

        var c = new EntityCollection<XXXEntity>();
        c.Add(pv);

        this.AdapterToUse.SaveEntityCollection(c, false, false).Dump();
    }
}

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 05-Nov-2018 09:12:56   

We'll look into it. We did rewrite that part for 5.5 for query batching (inheritance queries don't use batching however) and the machinery is therefore a bit different, but I have to check with the design docs whether this is expected or not and why our tests didn't pick it up simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 05-Nov-2018 10:33:00   

In previous versions we indeed simply increased a counter, and the current mechanism returns the # of queries executed. this usually works (including batches) but of course in the case of an inheritance query it doesn't (as those are seen as a single query object but contain multiple queries).

disappointed

We'll correct this.

Frans Bouma | Lead developer LLBLGen Pro
Findev
User
Posts: 103
Joined: 08-Dec-2014
# Posted on: 05-Nov-2018 11:31:41   

Awesome simple_smile Will wait for the fix to undo the current workarounds simple_smile

Thank you!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 05-Nov-2018 11:56:12   

Fixed in next build.

We'll wait a bit before we'll release a hotfix (a couple of days) as there might be other issues popping up in the coming days after release. If you need a build right away, I can attach it to this thread. In that case, please give the database type so we can attach the 5.5.1 dqe as well simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Findev
User
Posts: 103
Joined: 08-Dec-2014
# Posted on: 05-Nov-2018 12:03:30   

Otis wrote:

Fixed in next build.

We'll wait a bit before we'll release a hotfix (a couple of days) as there might be other issues popping up in the coming days after release. If you need a build right away, I can attach it to this thread. In that case, please give the database type so we can attach the 5.5.1 dqe as well simple_smile

Premium support... as always simple_smile I'll wait for a couple of days, thank you simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 05-Nov-2018 14:17:52   

smile

We're looking at Thursday for a release, Friday at the latest.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 09-Nov-2018 16:58:41   

Hotfix is now available

Frans Bouma | Lead developer LLBLGen Pro
Findev
User
Posts: 103
Joined: 08-Dec-2014
# Posted on: 09-Nov-2018 19:14:17   

Otis wrote:

Hotfix is now available

Updated. Works as expected. Thank you! simple_smile