question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handling EF Core concurrency conflicts.

See original GitHub issue

Abp 3.6 net core

https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.ZeroCore/Authorization/AbpLoginManager.cs#L122

_logInManager.LoginAsync(context.UserName, context.Password, tenant);

This code occasionally throws a DbUpdateConcurrencyException exception under concurrency.

How to handle these internal Exceptions?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

7reactions
hikalkancommented, Jan 14, 2019

Is it possible to open a separate unit of work and disable the transaction and then assign a value to the User’s LastLoginTime?

Doesn’t matter. Because the problem occurs when multiple clients use the same username to login. So, it will still be conflict.

I think LastLoginTime is still very useful for users.

I think so. However, it’s not essential. Because UserLoginAttempt stores all login attempts. So, you can easily query this table to find the last successful login.

2reactions
ryancyqcommented, Jun 13, 2018

Would checking the User.Identity.IsAuthenticated flag sufficient to avoid this?

public async Task MockLogin()
{
	if (!User.Identity.IsAuthenticated)
	{
	    await _logInManager.LoginAsync("admin", "123qwe");
	}
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Handle concurrency - ASP.NET MVC with EF Core
A concurrency conflict occurs when one user displays an entity's data in order to edit it, and then another user updates the same...
Read more >
Handling Concurrency in EF-Core
Concurrency means the conflicts happening on the data due to access to multiple users, trying to modify the same data at the same...
Read more >
How to handle concurrency in Entity Framework Core
Concurrency handling refers to the technique of detecting and resolving concurrency conflicts. It ensures safety, integrity and consistency of your data.
Read more >
Concurrency Management in Entity Framework Core
Concurrency conflicts occur when one user retrieves an entity's data to modify it, and then another user updates the same entity's data ...
Read more >
Best practice to handle concurrency in EF Core and ASP. ...
Yes, there is a generic way to manage concurrency in EF Core. You already did the first part by adding a column that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found