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
I have an entity with a geometry column which causes SaveChanges to take a long time (>1min) whenever the entities are tracked - presumably due to having to compare geometries to determine whether they have changed. Due to other areas of the project making use of lazy loading, I can't turn change tracking off globally and so I have to make sure to use AsNoTracking everywhere this particular entity type is used (including queries that Include them) which is proving a bit of a pain. I tried setting Metadata.AfterSaveBehaviour to PropertySaveBehaviour.Ignore but this seems to still attempt to track changes to the property even though it would then (I believe) ignore any changes it found.
Is there any way to exclude the particular property from change tracking? If AfterSaveBehaviour set to Ignore worked as one might expect this would be a start but ideally there should be some way of excluding the property in standard change tracking but still allow it to be manually mark as modified (using IsModified which I assume (although I haven't tested this) would still cause a property to be ignore when setting AfterSaveBehaviour).
The text was updated successfully, but these errors were encountered:
Putting this on the backlog to consider making this more first class. Open question: can reference equality be used safely without snapshotting? Consider #14042 and #19417 where snapshotting was important to fix bugs.
I would up vote on converting these to a first class, because doing this on a lot of columns, even if it is one column on every table, it's a lot of code for maintaining and means bloating the code.
I have an entity with a geometry column which causes
SaveChanges
to take a long time (>1min) whenever the entities are tracked - presumably due to having to compare geometries to determine whether they have changed. Due to other areas of the project making use of lazy loading, I can't turn change tracking off globally and so I have to make sure to use AsNoTracking everywhere this particular entity type is used (including queries thatInclude
them) which is proving a bit of a pain. I tried settingMetadata.AfterSaveBehaviour
toPropertySaveBehaviour.Ignore
but this seems to still attempt to track changes to the property even though it would then (I believe) ignore any changes it found.Is there any way to exclude the particular property from change tracking? If
AfterSaveBehaviour
set toIgnore
worked as one might expect this would be a start but ideally there should be some way of excluding the property in standard change tracking but still allow it to be manually mark as modified (usingIsModified
which I assume (although I haven't tested this) would still cause a property to be ignore when settingAfterSaveBehaviour
).The text was updated successfully, but these errors were encountered: