Effectively Managing Duplicate and Mismatched Properties in EntityTableData and Existing Database Entities #841
-
I’ve made several attempts to resolve this issue and have also reviewed similar issues such as this one and this SO post post. However, I ultimately decided not to use My current setup/use case: I have an existing table in my database called To avoid the issue of duplicate column names, I changed the DataSync column name from In my EF Core Model setup, I used the
My EF Core configuration needed a small change since the
As stated, creating new entities or querying the entities works fine with this setup. But when doing a replace (update), I get the following error, which is logical because DataSync seems to be using
Sadly, because of backward compatibility with another application, I cannot change the current int primary key in my database. So, I am considering the following options:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Take a look at the EntityTableRepository, which contains all the information you need. I'll see if I can put together a sample that provides what you are looking for. Basically, you have two entities - a "mobile entity" where the Id must be string and settable by the client, and a "normal entity" where the Id is int. You need to map between them. Since you have another client that is updating the records, you will also need to arrange for UpdatedAt, Version, and Deleted to be maintained by the other (non-mobile) client. UpdatedAt can be maintained through the use of a trigger, and Version is a [Timestamp], which is generally well supported. Deleted is usually the difficult one - instead of "hard deleting" a row, you will need to mark it as deleted and then hard delete it later. So, basically you copy the EntityTableRepository and adjust each and every method to do what you need. |
Beta Was this translation helpful? Give feedback.
-
I've just posted a new blog post @nicolasHul See https://adrianhall.github.io/azure/2023/12/22/zumo-intid/ |
Beta Was this translation helpful? Give feedback.
I've just posted a new blog post @nicolasHul
See https://adrianhall.github.io/azure/2023/12/22/zumo-intid/