Delta icon indicating copy to clipboard operation
Delta copied to clipboard

Support for custom ETag?

Open ThumbGen opened this issue 1 year ago • 7 comments

We are using EF Core with MS SqlServer and an own ETag field (GUID). I guess that I could add a RowVersion field (and opt out of the concurrency check), but we already have mid-air conflicts logic based on our ETag in our API clients, and I am afraid this will interfere with Delta's concepts. Would it be possible to use that ETag instead of the calculated one?

ThumbGen avatar Nov 28 '24 07:11 ThumbGen

we already have mid-air conflicts logic based on our ETag in our API clients

if you already have code to handle this, why r u considering Delta?

SimonCropp avatar Nov 28 '24 11:11 SimonCropp

We just populate the ETag and use it only for mid-air collision detection during save. I am tempted by Delta's offering on caching.

ThumbGen avatar Nov 28 '24 11:11 ThumbGen

I second this. We have a "LastModified"- Column in place which is basically a DATETIME2 based timestamp. Would be nice to be able to configure this column as the "ETAG" to be used.

NicoKno avatar Nov 29 '24 09:11 NicoKno

@NicoKno the complexity in that Delta does not use "a column". it uses a db level timestamp. to use a LastModified u would need to query all tables to find the newest last modified

SimonCropp avatar Nov 29 '24 09:11 SimonCropp

Sorry for my the misunderstanding. But isn't the RowVersion a db table column either? Sorry for bothering, I have to do a little more reading on that topic.

NicoKno avatar Nov 29 '24 10:11 NicoKno

I am considering also "the other way around" in our case. Ditching our ETag (a shadow prop of type GUID, that we don't use for concurrency anyway), and using your default ETag. Then we would get the best of "both worlds" (our mid-air collision logic is not depending on a GUID as ETag, it can be anything).

ThumbGen avatar Nov 29 '24 10:11 ThumbGen

RowVersion is per table. but because it is a special type of column, sql has a feature that allows you to query the newest RowVersion across all tables. and it a very efficient query, since it is actually implement as a db level counter. so the query is just "what the current counter value"

if you dont already use a row version for concurrency, i highly recommend it. here is an example ef usage https://learn.microsoft.com/en-us/aspnet/core/data/ef-mvc/concurrency?view=aspnetcore-9.0

SimonCropp avatar Nov 29 '24 10:11 SimonCropp