Replacement for AppDomain.GetLoadedAssemblies() in .NET Core?

Viewed 6411

I'm trying to write some logic to mirror some existing logic in an original .NET application. In my OnModelCreating() method I want to load all current types in loaded assemblies to find the ones that need to be registered for entity type configuration in the model.

This was done in .NET with AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetTypes()), however AppDomain no longer exists in .NET Core.

Is there a new way to do this?

I have seen some examples online of using DependencyContext.Default.RuntimeLibraries however DependencyContext.Default does not seem to exist anymore either.

Edit:

I have found now that adding Microsoft.Extensions.DependencyModel to a .netcoreapp1.1 project works. However I am actually writing a solution with multiple projects and I somehow need do this type loading in my .netstandard1.4 project where my DbContext implementation and entity type configuration is

2 Answers
Related