Exemplo n.º 1
0
        public EventProcessingObserver(IDatabaseContextFactory databaseContextFactory,
                                       IProjectionConfiguration projectionConfiguration)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(projectionConfiguration, nameof(projectionConfiguration));

            _databaseContextFactory  = databaseContextFactory;
            _projectionConfiguration = projectionConfiguration;
        }
        public UserProjectionHandler(IProjectionConfiguration configuration, IDatabaseContextFactory databaseContextFactory,
                                     ISystemUserQuery query)
        {
            Guard.AgainstNull(configuration, "configuration");
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(query, "query");

            _configuration          = configuration;
            _databaseContextFactory = databaseContextFactory;
            _query = query;
        }
        public ProjectionPosition(IDatabaseContextFactory databaseContextFactory, IDatabaseGateway databaseGateway,
                                  IProjectionPositionQueryFactory queryFactory, IProjectionConfiguration projectionConfiguration)
        {
            Guard.AgainstNull(projectionConfiguration, "projectionConfiguration");
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(databaseGateway, "databaseGateway");
            Guard.AgainstNull(queryFactory, "queryFactory");

            _projectionConfiguration = projectionConfiguration;
            _databaseContextFactory  = databaseContextFactory;
            _databaseGateway         = databaseGateway;
            _queryFactory            = queryFactory;
        }
Exemplo n.º 4
0
        public ProjectionEventReader(ISerializer serializer, IDatabaseContextFactory databaseContextFactory, IDatabaseGateway databaseGateway,
                                     IEventStoreQueryFactory queryFactory, IProjectionConfiguration projectionConfiguration)
        {
            Guard.AgainstNull(serializer, "serializer");
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(databaseGateway, "databaseGateway");
            Guard.AgainstNull(queryFactory, "queryFactory");
            Guard.AgainstNull(projectionConfiguration, "projectionConfiguration");

            _serializer              = serializer;
            _databaseContextFactory  = databaseContextFactory;
            _databaseGateway         = databaseGateway;
            _queryFactory            = queryFactory;
            _projectionConfiguration = projectionConfiguration;
        }
Exemplo n.º 5
0
 internal static ITraitResolver GetTraitResolver(IProjectionConfiguration configuration)
 {
     return configuration.TraitResolver ?? new StandardTraitResolver();
 }
Exemplo n.º 6
0
        internal static ProjectionOptions GetOptions(IProjectionConfiguration configuration)
        {
            var options = configuration.Options;

            switch (options & ProjectionOptionsInternal.AssemblyModes)
            {
                case ProjectionOptions.None:
                case ProjectionOptions.SaveAssemblies:
                case ProjectionOptions.CollectAssemblies:
                    return options;
                default:
                    throw Error.SaveAndCollectAssembliesNotSupported();
            }
        }
Exemplo n.º 7
0
 internal static int GetMaxTypesPerAssembly(IProjectionConfiguration configuration)
 {
     return configuration.MaxTypesPerAssembly ??
     (
         // In some versions of .NET, performance of TypeBuilder.CreateType degrades at O(n^2) as more
         // types are added to the dynamic assembly.  Workaround is to create one assembly per N types,
         // where N is a low-enough number.
         //
         // See: http://support.microsoft.com/kb/970924
         //
         Environment.Version.Major < 4 ? 4 : 64
     );
 }
Exemplo n.º 8
0
        internal static ProjectionAssemblyFactory GetAssemblyFactory(IProjectionConfiguration configuration)
        {
            var options = GetOptions(configuration);
            var threshold = configuration.MaxTypesPerAssembly;

            return threshold <= 0 ? ProjectionAssemblyFactory.Single (options)
                 : threshold == 1 ? ProjectionAssemblyFactory.PerType(options)
                 : ProjectionAssemblyFactory.Batched(threshold.Value, options);
        }