Example #1
0
        public static async Task <AggregateConfig> GetAggregatesAsync <TEntity>(IQueryable <TEntity> result, IAggregateConfig <AggregateColumn> config)
        {
            var resultConfig = new AggregateConfig(config);

            foreach (var column in resultConfig.Columns)
            {
                await SetAggregateAsync(result, column)
                .ConfigureAwait(false);
            }

            return(resultConfig);
        }
Example #2
0
 protected virtual Task CreateSnapShotCollectionIfNotExistsAsync(AggregateConfig config)
 {
     return(CreateCollectionAsync(SnapshotCollectionName(config.AggregateType), config.SnapshotOfferThroughput));
 }
Example #3
0
 protected virtual Task CreateAggregateCollectionIfNotExistsAsync(AggregateConfig config)
 {
     return(CreateCollectionAsync(config.AggregateType.Name, config.OfferThroughput));
 }
Example #4
0
        protected virtual Task CreateSnapshotTableForAggregateAsync(IDbConnection connection, AggregateConfig aggregateConfig)
        {
            var aggregateTable = string.Format(@"IF OBJECT_ID (N'{0}', N'U') IS NOT NULL

                                             DROP TABLE [{1}].[{0}]

                                             CREATE TABLE [{1}].[{0}](
	                                            [Id]               UNIQUEIDENTIFIER NOT NULL,
                                                [AggregateId]      UNIQUEIDENTIFIER NOT NULL,                                                
                                                [ClrType]          NVARCHAR (500)   NOT NULL,
                                                [AggregateVersion] INT              NOT NULL,
                                                [TimeStamp]        DATETIME2 (7)    NOT NULL,
                                                [Data]             NVARCHAR (MAX)   NOT NULL
	                                            PRIMARY KEY (AggregateId,[Id]))"    , SnapshotTableName(aggregateConfig.AggregateType), _config.Schema);

            return(connection.ExecuteAsync(aggregateTable));
        }
 public static AggregateConfig BindCarter(this AggregateConfig config)
 {
     config.Merge(new CarterComandHandlerSliceStartup());
     return(config);
 }