Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Using multiple applications to connect a single database using Entity Framework

I am currently developing a Windows form application, that I plan to run on a cloud setup, the application will calculate new data, update within the database and act as sort of control panel for a live data feed RestFul API that I wish to create using ASP.NET MVC 5 Web API.

I am wondering is it viable to connect these 2 separate applications to a single database? It is unlikely that I'd have database entry clash issues as each application has a separate task of reading or writing data for certain tables.

If viable would that mean every-time i make table changes I'd have to update both Entity Framework database models? (Not a major chore).

Is there a better solution to this? Should I scrap the idea of running a Windows Form application to control certain elements of the backend of the public API?

What would be the future issues with designing something like this, if any?

like image 450
Corona Avatar asked Jul 09 '26 18:07

Corona


1 Answers

So you have a bunch of options there, assuming you have a layered architecture:

  1. Share your DB, DAL and also Business Layer
  2. Extend your WEB API and utilize it in your WinForms
  3. Reuse DAL only (not the best approach, as business systems are not only data, but also - behavior - which resides in Business Layer)
  4. Share the DB only - this is the worst option, with numerous drawbacks

See options 1 and 2 on an image:

enter image description here enter image description here

like image 75
ironstone13 Avatar answered Jul 11 '26 09:07

ironstone13