Ejemplo n.º 1
0
        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);
        }