コード例 #1
0
        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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public static IBoundedContextModel WithEventHandler <TEventHandler>(this IBoundedContextModel contextMap)
        {
            AutoConfigure.MapEventHandler(contextMap, typeof(TEventHandler));

            return(contextMap);
        }
コード例 #4
0
        public static IBoundedContextModel WithAggregateRoot <TAggregateRoot>(this IBoundedContextModel contextMap)
        {
            AutoConfigure.MapAggregate(contextMap, typeof(TAggregateRoot));

            return(contextMap);
        }