public static IBoundedContextModel WithAssembly(this IBoundedContextModel contextMap, Assembly assembly, string contextNamespace) { if (assembly == null) { throw new ArgumentNullException(nameof(assembly)); } AutoConfigure.FromAssembly(contextMap, assembly, contextNamespace); return(contextMap); }
public static void FromAssembly(IBoundedContextModel contextMap, Assembly assembly, string contextNamespace) { if (assembly == null) { throw new ArgumentNullException(nameof(assembly)); } var publicTypes = contextNamespace == null?assembly.GetExportedTypes() : assembly.GetExportedTypes().Where(t => t.Namespace.StartsWith(contextNamespace)); AutoConfigure.MapAggregates(contextMap, publicTypes); var allPublicTypesExceptAggregates = publicTypes.Where(t => !contextMap.IsAggregateType(t)).Distinct(); AutoConfigure.MapEventHandlers(contextMap, allPublicTypesExceptAggregates); }
public static IBoundedContextModel WithEventHandler <TEventHandler>(this IBoundedContextModel contextMap) { AutoConfigure.MapEventHandler(contextMap, typeof(TEventHandler)); return(contextMap); }
public static IBoundedContextModel WithAggregateRoot <TAggregateRoot>(this IBoundedContextModel contextMap) { AutoConfigure.MapAggregate(contextMap, typeof(TAggregateRoot)); return(contextMap); }