Global Data Management Forum

 View Only
Expand all | Collapse all

IBM.EntityFrameworkCore 6.0.0.300 isn't selecting the correct ID after inserting

  • 1.  IBM.EntityFrameworkCore 6.0.0.300 isn't selecting the correct ID after inserting

    Posted Wed September 07, 2022 11:53 AM
    Our app is sending multiple requests to a webserver, which in turn inserts records into an Informix database, but some inserts are getting duplicate IDs from the database when using the .Net Core package. However we dont get duplicate IDs when using the .Net Framework package.

    I think the problem is how the ID is selected after the insert

    Compare the SELECTs generated from dbContext.SaveChanges() in core (IBM.EntityFrameworkCore 6.0.0.300) to the SELECT from the .Net Framework package(EntityFramework.IBM.DB2 6.4.1).

    (IBM.EntityFrameworkCore 6.0.0.300):

    INSERT INTO log (log_action, log_date, log_db, log_description, log_loggedby)
    VALUES (@p0, @p1, @p2, @p3, @p4);
    SELECT * FROM TABLE ( MULTISET ( SELECT FIRST 1 log_id FROM log ORDER BY log_id DESC)) ORDER BY log_id ASC;

    (EntityFramework.IBM.DB2 6.4.1): 


    insert into log(log_db, log_date, log_loggedby, log_action, log_description)
    values (@p0, @p1, @p2, @p3, @p4)
    ; select log_id as "log_id"
    from log
    where dbinfo('sqlca.sqlerrd2') > 0 and log_id = dbinfo('sqlca.sqlerrd1')

    Thanks,
    John


    ------------------------------
    John Robinson
    ------------------------------

    #DataManagementGlobal
    #DataServerDrivers


  • 2.  RE: IBM.EntityFrameworkCore 6.0.0.300 isn't selecting the correct ID after inserting

    Posted Wed September 07, 2022 12:06 PM
    This post can be deleted. I thought I did something wrong and didn't submit the form.

    ------------------------------
    John Robinson
    ------------------------------