You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have an issue with concurrency checks in my Saga.
In the Wolverine example for mapping Saga in EF Core, there is no information about the Version used for concurrency.
(it's auto-mapped because it's a simple int property with a public setter)
// Example from documentationprotectedoverridevoidOnModelCreating(ModelBuildermodelBuilder){// Your normal EF Core mappingmodelBuilder.Entity<Order>(map =>{map.ToTable("orders","sample");map.HasKey(x =>x.Id);map.Property(x =>x.OrderStatus).HasConversion(v =>v.ToString(), v =>Enum.Parse<OrderStatus>(v));});}
publicabstractclassSaga{// Other parts.../// <summary>/// For saga providers that support this, this is a version of the saga to help enforce optimistic concurrency/// protections. This value is the current version that is stored by the saga storage and will/// be incremented upon save/// </summary>publicintVersion{get;set;}}
It should be uint and mapped as .IsRowVersion because internally it uses the xmin column with type xid.
Because it's not int instead of int, it is not mapped correctly, and concurrent check doesn't work.
What should I do? Introduce my own Version property or switch to lightweight storage?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have an issue with concurrency checks in my Saga.
In the Wolverine example for mapping Saga in EF Core, there is no information about the Version used for concurrency.
(it's auto-mapped because it's a simple
intproperty with a public setter)But... when I use PostgreSQL, they recommend handling Version differently:
https://www.npgsql.org/efcore/modeling/concurrency.html?tabs=fluent-api
It should be
uintand mapped as.IsRowVersionbecause internally it uses thexmincolumn with typexid.Because it's not
intinstead ofint, it is not mapped correctly, and concurrent check doesn't work.What should I do? Introduce my own Version property or switch to lightweight storage?
Beta Was this translation helpful? Give feedback.
All reactions