I have created an application that manages Hotels, Rooms, Reservations and customers. In the first version I used pure MySQL commands to communicate with the database and worked perfectly but it was quite hard to implement, mostly when I needed to change the name of a property or the order in the database and relative commanding in complex entities, and also was slow on taking the result. So i tried to implement it using Entity Framework. Since then i faced too many problems that I am trying to go around. First of all, my app is used by two clients and I need the data to be synced. EF is caching data for faster results even if they change at the DB. As far as I know EF doesn't check if the data is current and the solutions I have found for this were:
- to reload or detach every single entity - something bad while having like 300 rooms or 2000 customers
- to dispose and recreate the context - this is what I tried to do but it seems hard to implement because my app can have 3 or 4 windows in the same time and then I need to reload the ItemSource in every Combobox and list otherwise when I use it again exceptions are thrown like "context is disposed" or "entity changes are tracked by many trackers" or "foreign key is not exposed" etc. Also this way you lose the change tracker.
An other big problem is that when i don't use my app for a while and then access a property of an entity that tries to get by lazy loading it might crash if the connection or command timeout is reached. Maybe it can be solved by exception handling but I thought EF could manage those kind of things.
The thing is that I need the change tracker to update the entities, I also use MVVMlight and a generic repository I found in the internet with UnitOfWork. https://cpratt.co/truly-generic-repository/
My app is WPF 4.7.2
Is there any suggestion? Should I use some other framework for communicating with the DB? Should I use other kind of DB? Other programming language?
Another