Reputation: 643
I have a website developed with ASP.NET MVC, Entity Framework Code First and SQL Server. The website has entities that each have a history of statuses that we defined (NEW, PACKED, SHIPPED etc.) The DB contains a table in which a completely separate system inserts parcel tracking data. I have to read this data tracking data and, following certain business rules, add to the existing status history of my entities.
The best way I can think of is to write an independent Windows service to poll the tracking data every so often and update my entity statuses from that. However, that makes me concerned about DB concurrency issues.
Please could someone advise me on the best strategy for this scenario? Many thanks
Upvotes: 2
Views: 180
Reputation: 32447
There are different ways to do it. It also depends on the response time you need. If you need to update your system as soon as the tracking system updates the record then a trigger is the preferred way. Alternative way is to schedule a job which will run every 15/30mins and sync the 2 systems.
As for the concurrency issue you can use a concurrency token field. Entity framework has support for this.
Upvotes: 1