Base solution for your next web application
Open Closed

InserAndGetId #9907


User avatar
0
lweng567 created

Prerequisites Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

What is your product version? Lastest Zero What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .netCore

Hi, In my create method, i need to first create an entity and then use the entity Id to do non-transactional activity (for example, write to a file), so I use repository<MyEntity>.InsetAndGetIdAsync to return the Id. My understanding is InsertAndGetIdAsync will commit the transaction and write the record to the database. But to my supprise, although InsertAndGetIdAsync returns a correct Id, but not database record is created if writing out the id to a file fails (means rollback), when i look at the abpEntityChange audit, the record change was actually logged with the correct Id. I thought if the file writing fails and record writing to the database was rollback, then the audit should not have been written, otherwise, user can see the audit but could not find the record.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @lweng567

    Audit log is written for failed attempts as well, this is by design.