Exemple #1
0
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                var i = 0;

                services.AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService, SomeService>();
                return(services);
            }
Exemple #2
0
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     ApiBase.ConfigureApi(apiType, services);
     services.MakeScoped <ISomeService>()
     .AddService <ISomeService>((sp, next) => new SomeService());
     return(services);
 }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                var changeSetPreparer = new TestChangeSetInitializer();
                var submitExecutor    = new TestSubmitExecutor();

                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IChangeSetInitializer>((sp, next) => changeSetPreparer);
                services.AddService <ISubmitExecutor>((sp, next) => submitExecutor);
                var i = 0;

                services.AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService>((sp, next) => new SomeService
                {
                    Inner = next,
                    Value = i++
                })
                .AddService <ISomeService, SomeService>();
                return(services);
            }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                var changeSetPreparer      = new TestChangeSetInitializer();
                var submitExecutor         = new TestSubmitExecutor();
                var queryExpressionSourcer = new TestQueryExpressionSourcer();

                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IChangeSetInitializer>((sp, next) => changeSetPreparer);
                services.AddService <ISubmitExecutor>((sp, next) => submitExecutor);
                services.AddService <IQueryExpressionSourcer>((sp, next) => queryExpressionSourcer);

                services.AddService <ISomeService>((sp, next) => new SomeService
                {
                    Value = 1
                })
                .AddService <ISomeService, SomeService3>()
                .AddSingleton(new SomeService
                {
                    Value = 2
                })
                .MakeTransient <ISomeService>()
                .AddService <string>((sp, next) => { return("0"); })
                .MakeTransient <string>();
                return(services);
            }
Exemple #5
0
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IServiceA>((sp, next) => ApiService);

                return(services);
            }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                var service = new TestSingleCallModelBuilder();

                services.AddService <IModelBuilder>((sp, next) => service);
                return(services);
            }
Exemple #7
0
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     services.AddService <IModelBuilder>((sp, next) => new TestModelProducer(FallbackModel.Model));
     services.AddService <IModelMapper>((sp, next) => new FallbackModelMapper());
     services.AddService <IQueryExpressionSourcer>((sp, next) => new FallbackQueryExpressionSourcer());
     services = ApiBase.ConfigureApi(apiType, services);
     return(services);
 }
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     ApiBase.ConfigureApi(apiType, services);
     services.AddService <IServiceA>((sp, next) => serviceA);
     services.AddService <IServiceB>((sp, next) => serviceB);
     services.AddService <IServiceB, ServiceB>();
     services.AddSingleton(new ServiceB());
     return(services);
 }
Exemple #9
0
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     services = ApiBase.ConfigureApi(apiType, services);
     services.AddService <IModelBuilder>((sp, next) => new TestModelProducer(StoreModel.Model));
     services.AddService <IModelMapper>((sp, next) => new TestModelMapper());
     services.AddService <IQueryExpressionSourcer>((sp, next) => new TestQueryExpressionSourcer());
     services.AddService <IChangeSetInitializer>((sp, next) => new TestChangeSetInitializer());
     services.AddService <ISubmitExecutor>((sp, next) => new TestSubmitExecutor());
     return(services);
 }
Exemple #10
0
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                services.AddService <ISomeService>((sp, next) => new SomeService
                {
                    Value = 2
                })
                .MakeTransient <ISomeService>()
                .AddService <ISomeService, SomeService2>();

                return(services);
            }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                var changeSetPreparer      = new TestChangeSetInitializer();
                var submitExecutor         = new TestSubmitExecutor();
                var queryExpressionSourcer = new TestQueryExpressionSourcer();

                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IChangeSetInitializer>((sp, next) => changeSetPreparer);
                services.AddService <ISubmitExecutor>((sp, next) => submitExecutor);
                services.AddService <IQueryExpressionSourcer>((sp, next) => queryExpressionSourcer);

                return(services);
            }
Exemple #12
0
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                var first = new SomeService
                {
                    Value = 42
                };

                services.MakeTransient <ISomeService>()
                .AddService <ISomeService>((sp, next) => first)
                .AddService <ISomeService, SomeService2>()
                .AddSingleton("Text");
                return(services);
            }
Exemple #13
0
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                var changeSetPreparer = new TestChangeSetInitializer();
                var submitExecutor    = new TestSubmitExecutor();

                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IChangeSetInitializer>((sp, next) => changeSetPreparer);
                services.AddService <ISubmitExecutor>((sp, next) => submitExecutor);
                services.AddService <IServiceA>((sp, next) => serviceA);
                services.AddService <IServiceB>((sp, next) => serviceB);
                services.AddService <IServiceB, ServiceB>();
                services.AddSingleton(new ServiceB());
                return(services);
            }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                var q1 = new ServiceB("q1Pre", "q1Post");
                var q2 = new ServiceB("q2Pre", "q2Post");

                services.AddService <IServiceB>((sp, next) => q1)
                .AddService <IServiceB>((sp, next) =>
                {
                    q2.InnerHandler = next;
                    return(q2);
                });

                return(services);
            }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IModelBuilder>((sp, next) => new TestModelProducer());
                services.AddService <IModelBuilder>((sp, next) => new TestModelExtender(2)
                {
                    InnerHandler = next,
                });
                services.AddService <IModelBuilder>((sp, next) => new TestModelExtender(3)
                {
                    InnerHandler = next,
                });

                return(services);
            }
Exemple #16
0
        public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
        {
            Func <IServiceProvider, IDataStoreManager <string, TripPinDataSource> > defaultDataStoreManager =
                sp => new DefaultDataStoreManager <string, TripPinDataSource>()
            {
                MaxDataStoreInstanceCapacity = 1000,
                MaxDataStoreInstanceLifeTime = new TimeSpan(0, 30, 0)
            };

            services.AddService <IModelBuilder>((sp, next) => new ModelBuilder());
            services.AddService <IChangeSetInitializer>((sp, next) => new ChangeSetInitializer <TripPinDataSource>());
            services.AddService <ISubmitExecutor>((sp, next) => new SubmitExecutor());
            services.AddSingleton(defaultDataStoreManager);
            return(ApiBase.ConfigureApi(apiType, services));
        }
Exemple #17
0
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                var changeSetPreparer      = new TestChangeSetInitializer();
                var submitExecutor         = new TestSubmitExecutor();
                var queryExpressionSourcer = new TestQueryExpressionSourcer();

                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IChangeSetInitializer>((sp, next) => changeSetPreparer);
                services.AddService <ISubmitExecutor>((sp, next) => submitExecutor);
                services.AddService <IQueryExpressionSourcer>((sp, next) => queryExpressionSourcer);
                var q1 = new ServiceB("q1Pre", "q1Post");
                var q2 = new ServiceB("q2Pre", "q2Post");

                services.AddService <IServiceB>((sp, next) => q1)
                .AddService <IServiceB>((sp, next) =>
                {
                    q2.InnerHandler = next;
                    return(q2);
                });

                return(services);
            }
            public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
            {
                var changeSetPreparer      = new TestChangeSetInitializer();
                var submitExecutor         = new TestSubmitExecutor();
                var queryExpressionSourcer = new TestQueryExpressionSourcer();

                ApiBase.ConfigureApi(apiType, services);
                services.AddService <IChangeSetInitializer>((sp, next) => changeSetPreparer);
                services.AddService <ISubmitExecutor>((sp, next) => submitExecutor);
                services.AddService <IQueryExpressionSourcer>((sp, next) => queryExpressionSourcer);

                services.AddService <IModelBuilder>((sp, next) => new TestModelProducer());
                services.AddService <IModelBuilder>((sp, next) => new TestModelExtender(2)
                {
                    InnerHandler = next,
                });
                services.AddService <IModelBuilder>((sp, next) => new TestModelExtender(3)
                {
                    InnerHandler = next,
                });

                return(services);
            }
Exemple #19
0
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     return(ApiBase.ConfigureApi(apiType, services).AddScoped <MyPropertyBag>());
 }
Exemple #20
0
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     return(ApiBase.ConfigureApi(apiType, services)
            .MakeScoped <IService>()
            .AddService <IService, Service>());
 }