I need to add a RowVersion column to all my tables. I need it for reasons like data warehousing (and similar DB only actions). I don't want to use it for concurrency.
I want Entity Framework to keep working as if the RowVersion column is not there. But I can't seem to see a way to do that.
When ever I do an update, SQL Profile tells me this is what is being executed:
update [dbo].[Widget]
set [WidgetCost] = @0
where ([WidgetId] = @1)
select [RowVersionId]
from [dbo].[Widget]
where @@ROWCOUNT > 0 and [WidgetId] = @1
If I don't have the RowVersion column on the table then the second select statement does not happen.
How can I get Entity Framework to just ignore the RowVersionId column? If at all possible I would prefer a method that does not require manually editing the csdl/msdl after each update of the model from the database. (Someone will forget eventually.)
I have tried:
NOTE: As long as I don't update the table in EF's designer (edmx) after I add the column, it works as expected. So there is something in Entity Framework that this doing this. (But I can't just lock down my edmx from begin updated after I add this column.)
I looked into this a bit more. If you change the StoreGeneratedPattern for the RowVersion column from "Computed" to "None", then it will not do the extra lookup.