Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Command overload #28

Open
alexcastrodev opened this issue Oct 19, 2023 · 1 comment · Fixed by #29
Open

DB Command overload #28

alexcastrodev opened this issue Oct 19, 2023 · 1 comment · Fixed by #29

Comments

@alexcastrodev
Copy link
Owner

Based on BulkController on line 98, the ProcessExcelRow is overloaded:

image

Scenario:

A user upload a excel file, then, the function will read line by line, check if this line exist, then, will saveChanges.

Why not transaction ?

The Transaction is save all or nothing. If some line has error, i dont want to rollback. I want to save in database all succeed and return a blob of errors.

Possible solutions:

1 - Divide in chunks of inserts, and it will decrease the inserts / select commands
2 - Save the Succeded and call a new transaction to save all of them.

dbContext.ChangeTracker.Entries()
                .Where(e => e.State == EntityState.Added || e.State == EntityState.Modified)
                .Select(e => e.Entity);

3 - First select all stored ids, before perform a Stream.

@alexcastrodev alexcastrodev linked a pull request Oct 19, 2023 that will close this issue
@alexcastrodev
Copy link
Owner Author

I Merged the solution 3, but i will try do something like solution 2 until sunday.

I dont know if i have time for this, since i want to implement redis for request locations.

@alexcastrodev alexcastrodev reopened this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant