in MongoDB I need to register class-maps dynamically that I don't need to register all the current and future-classes myself.
There is a Method called
BsonClassMap.RegisterClassMap<T>
but with this I need to know the Class (T) and can't use a Type instead.
I want to iterate through the assembly-types like this to register the class-maps:
var assemblyTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(t => t.GetTypes()).Where(t => t.IsClass);
foreach (var type in assemblyTypes)
{
//Register classmap for type
}
Is there a way to do that?