Beispiel #1
0
        private void AddServiceActivityHandlerType(ReqResHandler rt)
        {
            var activityHandler1Type = typeof(Brimborium.Latrans.Activity.IActivityHandler <>).MakeGenericType(rt.RequestType);
            var activityHandler2Type = typeof(Brimborium.Latrans.Activity.IActivityHandler <,>).MakeGenericType(rt.RequestType, rt.ResponseType);

            this.Services.AddTransient(activityHandler1Type, rt.ActivityHandler);
            this.Services.AddTransient(activityHandler2Type, rt.ActivityHandler);
            this.Services.AddTransient(rt.ActivityHandler, rt.ActivityHandler);
        }
Beispiel #2
0
            ) AddServiceActivityContextType(ReqResHandler rt)
        {
            var activityContextType = typeof(Brimborium.Latrans.Mediator.MediatorContext <>).MakeGenericType(rt.RequestType);

            var factoryActivityContext = Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(
                activityContextType,
                new Type[] { typeof(CreateActivityContextArguments), rt.RequestType });

            var medaitorClientConnectedType = typeof(Brimborium.Latrans.Mediator.MediatorClientConnected <,>).MakeGenericType(rt.RequestType, rt.ResponseType);

            var factoryClientConnected = Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(
                medaitorClientConnectedType,
                new Type[] { typeof(CreateClientConnectedArguments), rt.RequestType });

            this.Services.AddTransient(activityContextType, activityContextType);
            return(activityContextType, factoryActivityContext, factoryClientConnected);
        }