adamfoneil / ModelSync

A C# model class and database schema comparison, SQL diff scripting library
MIT License
6 stars 2 forks source link

implement "reflection only" assembly inspection #2

Closed adamfoneil closed 4 years ago

adamfoneil commented 4 years ago

It's too unpredictable to load assemblies with LoadFrom or Load. There's just no simple way to ensure dependencies are present, and the mechanism for examining dependencies dynamically -- the AssemblyResolve event or whatever it is -- is just not straightforward enough.

The problem of course with "reflection only" assembly load is that attributes aren't supported in the usual way. Attribute info is available, but through some kind of abstraction that's very unlike ordinary attribute access I've done in the past. So, I think this can be done, but I'm really annoyed that I have to do this.

adamfoneil commented 4 years ago

Reflection-only loading still doesn't load all dependencies reliably, even if you have a working ReflectionOnlyAssemblyResolve event:

image

adamfoneil commented 4 years ago

Looked at this, but can't tell relevance https://stackoverflow.com/questions/40849745/what-is-deps-json-and-how-do-i-make-it-use-relative-paths

I'm thinking there could be a helper you could add to your project that outputs the data model on startup so that ModelSync can load it without using reflection

adamfoneil commented 4 years ago

I'm shifting effort to #3