Ejemplo n.º 1
0
        protected override IServiceCollection ConfigureApi(IServiceCollection services)
        {
            Type apiType = this.GetType();

            // Add core and convention's services
            services = services.AddCoreServices(apiType)
                       .AddAttributeServices(apiType)
                       .AddConventionBasedServices(apiType);

            // Add EF related services
            services.AddEfProviderServices <T>();

            // This is used to add the publisher's services
            ApiConfiguration.GetPublisherServiceCallback(apiType)(services);

            return(services);
        }
Ejemplo n.º 2
0
        protected override IServiceCollection ConfigureApi(IServiceCollection services)
        {
            Type apiType = this.GetType();

            // Add core and conversion's services
            services = services.AddCoreServices(apiType)
                       .AddAttributeServices(apiType)
                       .AddConventionBasedServices(apiType);

            // Add EF related services
            services.AddEfProviderServices <NorthwindContext>();

            // Add customized services, after EF model builder and before WebApi operation model builder
            services.ChainPrevious <IModelBuilder, NorthwindModelExtender>();

            // This is used to add the publisher's services
            ApiConfiguration.GetPublisherServiceCallback(apiType)(services);

            return(services);
        }