示例#1
0
        private void buildAsyncDaemonAggregation()
        {
            var daemonBuilderIsAsync = _applyMethods.IsAsync || _createMethods.IsAsync || _shouldDeleteMethods.IsAsync;
            var baseType             = (daemonBuilderIsAsync ? typeof(AsyncDaemonAggregationBase <,>) : typeof(SyncDaemonAggregationBase <,>))
                                       .MakeGenericType(typeof(T), _aggregateMapping.IdType);

            _asyncDaemonType =
                _assembly.AddType(GetType().Name.Sanitize() + "AsyncDaemonAggregation", baseType);

            _asyncDaemonType.AllInjectedFields.Add(new InjectedField(_storageType));

            var injectedField = new InjectedField(GetType());

            _asyncDaemonType.AllInjectedFields.Add(injectedField);

            // Build the create method
            _createMethods.BuildCreateMethod(_asyncDaemonType, _aggregateMapping);

            buildDetermineOperationMethodForDaemonRunner(daemonBuilderIsAsync);

            buildAsyncDaemonSplitMethod();

            _asyncDaemonType.Setters.AddRange(_applyMethods.Setters());
            _asyncDaemonType.Setters.AddRange(_createMethods.Setters());
            _asyncDaemonType.Setters.AddRange(_shouldDeleteMethods.Setters());
        }
示例#2
0
        private void buildInlineAggregationType()
        {
            var inlineBaseType =
                typeof(AggregationRuntime <,>).MakeGenericType(typeof(T), _aggregateMapping.IdType);

            _inlineType = _assembly.AddType(GetType().NameInCode().Sanitize() + "InlineHandler", inlineBaseType);

            _createMethods.BuildCreateMethod(_inlineType, _aggregateMapping);

            _inlineType.AllInjectedFields.Add(new InjectedField(GetType()));

            var method = buildDetermineOperationMethod();

            var upsertMethod = typeof(IDocumentStorage <>).MakeGenericType(typeof(T)).GetMethod("Upsert");

            var upsert = new MethodCall(_storageType, upsertMethod)
            {
                ReturnAction = ReturnAction.Return
            };

            method.Frames.Add(upsert);

            _inlineType.Setters.AddRange(_applyMethods.Setters());
            _inlineType.Setters.AddRange(_createMethods.Setters());
            _inlineType.Setters.AddRange(_shouldDeleteMethods.Setters());
        }
示例#3
0
        private void buildInlineAggregationType(GeneratedAssembly assembly)
        {
            var inlineBaseType = baseTypeForAggregationRuntime();

            _inlineGeneratedType = assembly.AddType(_inlineAggregationHandlerType, inlineBaseType);

            _createMethods.BuildCreateMethod(_inlineGeneratedType, _aggregateMapping);

            _inlineGeneratedType.AllInjectedFields.Add(new InjectedField(GetType()));

            buildApplyEventMethod();

            _inlineGeneratedType.Setters.AddRange(_applyMethods.Setters());
            _inlineGeneratedType.Setters.AddRange(_createMethods.Setters());
            _inlineGeneratedType.Setters.AddRange(_shouldDeleteMethods.Setters());
        }
        private void buildInlineAggregationType()
        {
            var inlineBaseType =
                typeof(AggregationRuntime <,>).MakeGenericType(typeof(T), _aggregateMapping.IdType);

            _inlineType = _assembly.AddType(GetType().NameInCode().Sanitize() + "InlineHandler", inlineBaseType);

            _createMethods.BuildCreateMethod(_inlineType, _aggregateMapping);

            _inlineType.AllInjectedFields.Add(new InjectedField(GetType()));

            buildApplyEventMethod();

            _inlineType.Setters.AddRange(_applyMethods.Setters());
            _inlineType.Setters.AddRange(_createMethods.Setters());
            _inlineType.Setters.AddRange(_shouldDeleteMethods.Setters());
        }