adamfoneil / ModelSync.UI

A diff/merge app for C# model classes to SQL Server. Also merges from database to database
https://aosoftware.net/modelsync/
3 stars 0 forks source link

new json data model connection source #21

Open adamfoneil opened 3 years ago

adamfoneil commented 3 years ago

Some source assemblies (well, a lot) have a dependency footprint that doesn't work with ModelSync. For example, I'm working in this TimeKeeper project, whose Domain project is a .NET5 assembly. ModelSync requires a .NET Standard 2.0 assembly with only AO.Models dependency, which is pretty restrictive. I know I've considered in the past an abstraction layer that builds a data model file as a post build process. This would remove the reflection requirement, and greatly expand the reach of ModelSync so it works in many more scenarios.

adamfoneil commented 3 years ago

Yeah I had tried this here, but there's a broken link in my closing comment. The thing I made is DataModelHelper. I'm not sure I'm on board with this now, but it does get around the reflection issue. But it adds a requirement to run your project instead of just building it, which is not the best experience.

adamfoneil commented 3 years ago

Possibly a Source Generator would work well here

adamfoneil commented 3 years ago

I think the best way to do this will be to have the user create a little console app in their solution (invoked as a custom build event) that loads the model class assembly and builds the json output from there, with a very simple NuGet package I will offer. This will add a new Json source in the source dropdown. Will of course need good wiki instructions and video demo.

image

This approach removes the dynamic assembly load, shifting that burden onto the end user to load it statically from a tiny console app.