コード例 #1
0
        internal override IReadOnlyList <IAsyncProjectionShard> AsyncProjectionShards(DocumentStore store)
        {
            if (_inlineType == null)
            {
                Compile();
            }

            var projection = Build((DocumentStore)store);

            // TODO -- sharding behavior
            var baseFilters = new ISqlFragment[0];
            var eventTypes  = MethodCollection.AllEventTypes(_createMethods, _projectMethods);

            if (!eventTypes.Any(x => x.IsAbstract || x.IsInterface))
            {
                baseFilters = new ISqlFragment[] { new Marten.Events.Daemon.EventTypeFilter(store.Events, eventTypes) };
            }

            var shard = new AsyncProjectionShard(new ShardName(ProjectionName), projection, baseFilters, store,
                                                 Options);

            return(new List <IAsyncProjectionShard> {
                shard
            });
        }
コード例 #2
0
        internal override IReadOnlyList <IAsyncProjectionShard> AsyncProjectionShards(DocumentStore store)
        {
            var shard = new AsyncProjectionShard(new ShardName(ProjectionName), _projection, System.Array.Empty <ISqlFragment>(), (DocumentStore)store, Options);

            return(new List <IAsyncProjectionShard> {
                shard
            });
        }
コード例 #3
0
        IReadOnlyList <IAsyncProjectionShard> IProjectionSource.AsyncProjectionShards(IDocumentStore store, ITenancy tenancy)
        {
            // TODO -- an actual sharding strategy!!!
            if (_inlineType == null)
            {
                Compile();
            }

            var projection = this.As <IProjectionSource>().Build((DocumentStore)store);

            // TODO -- how do users specify AsyncOptions config?
            // TODO -- sharding behavior
            var shard = new AsyncProjectionShard(ProjectionName, projection, new ISqlFragment[0], (DocumentStore)store,
                                                 new AsyncOptions());

            return(new List <IAsyncProjectionShard> {
                shard
            });
        }
コード例 #4
0
 internal bool TryFindAsyncShard(string projectionOrShardName, out AsyncProjectionShard shard)
 {
     return(_asyncShards.Value.TryGetValue(projectionOrShardName, out shard));
 }