예제 #1
0
        public static IEventFlowOptions AddSnapshotUpgraders(
            this IEventFlowOptions eventFlowOptions,
            Assembly fromAssembly,
            Predicate <Type> predicate = null)
        {
            predicate = predicate ?? (t => true);

            var snapshotUpgraderTypes = fromAssembly
                                        .GetTypes()
                                        .Where(t => !t.IsAbstract)
                                        .Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ISnapshotUpgrader <,>)))
                                        .Where(t => predicate(t));

            return(eventFlowOptions.AddSnapshotUpgraders(snapshotUpgraderTypes));
        }
        public static IEventFlowOptions AddSnapshotUpgraders(
            this IEventFlowOptions eventFlowOptions,
            Assembly fromAssembly,
            Predicate<Type> predicate = null)
        {
            predicate = predicate ?? (t => true);

            var snapshotUpgraderTypes = fromAssembly
                .GetTypes()
                .Where(t => !t.GetTypeInfo().IsAbstract)
                .Where(t => t.GetTypeInfo().GetInterfaces().Any(IsSnapshotUpgraderInterface))
                .Where(t => !t.HasConstructorParameterOfType(IsSnapshotUpgraderInterface))
                .Where(t => predicate(t));

            return eventFlowOptions.AddSnapshotUpgraders(snapshotUpgraderTypes);
        }
 public static IEventFlowOptions AddSnapshotUpgraders(
     this IEventFlowOptions eventFlowOptions,
     params Type[] snapshotUpgraderTypes)
 {
     return eventFlowOptions.AddSnapshotUpgraders((IEnumerable<Type>)snapshotUpgraderTypes);
 }