First of all I know the classic Class Library is not compatible with UWP projects, or Xamarin projects. This is not what this is about.
I'm very used to creating applications where a Web App and a Desktop Application (Win Forms) would shared the same database. I would simply create a Class Library (classic) and used as the DbContext
for the whole solution. It was very simple. Back then, I was able to Enable-Migrations
directly in the class library and it would work like a charm.
Nowadays, Windows Forms are deprecated, or rather, removed from Asp.NET Core and classic Class Libraries can't be referenced in UWP projects. I also can't enable migrations (Add-Migration
, now the enable-migrations
is obsolete) in UWP Class Libraries. It tells me to do it inside a UWP Application, not in a library.
Is there anyway to bypass this? I don't care if I have to create yet another layer to make some sort of "middle maning", as long as I don't have to create data access models in each application. This next project will have two UWP apps (one of them being design for IoT), an MVC Web App, and two Xamarin apps (Android and iOS).
I also accept structure related suggestions... Maybe I'm overthinking this. Thanks.
Edit: I would like to add that I tried to use "Shared Project", and whilst it presents a nice tool, it doesn't do what I need.