// @robertmclaws: If you create a new AspNetCore project, this function gets called by the framework
 //                to register services for the application. THIS is where RESTier would be registered
 //                in a .NET Core app.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddSingleton <SampleModelBuilder>();
     // @robertmclaws: THIS is where RESTier should fill in the gaps from what the user has already registered, so that
     //                the system can work automagically. No ridiculousness. Simple, clean, effective.
     EntityFrameworkApi <SampleDbContext> .RegisterDependencies(services);
 }
Exemple #2
0
        // Need to register publisher services as MapRestierRoute is not called
        public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
        {
            EntityFrameworkApi <LibraryContext> .ConfigureApi(apiType, services);

            services.AddODataServices <LibraryApi>();
            return(services);
        }
Exemple #3
0
        public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
        {
            EntityFrameworkApi <LibraryContext> .ConfigureApi(apiType, services);

            services.AddService <IModelBuilder, ModelBuilder>();

            return(services);
        }
Exemple #4
0
        protected static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
        {
            // Add customized OData validation settings
            Func <IServiceProvider, ODataValidationSettings> validationSettingFactory = (sp) => new ODataValidationSettings
            {
                MaxAnyAllExpressionDepth = 3,
                MaxExpansionDepth        = 3
            };

            return(EntityFrameworkApi <TrippinModel> .ConfigureApi(apiType, services)
                   .AddSingleton <ODataPayloadValueConverter, CustomizedPayloadValueConverter>()
                   .AddSingleton <ODataValidationSettings>(validationSettingFactory)
                   .AddService <IChangeSetItemFilter, CustomizedSubmitProcessor>()
                   .AddService <IModelBuilder, TrippinModelExtender>());
        }
Exemple #5
0
        public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
        {
            // Add customized OData validation settings  自定义查询设置
            Func <IServiceProvider, ODataValidationSettings> validationSettingFactory = sp => new ODataValidationSettings
            {
                MaxAnyAllExpressionDepth = 3,
                MaxExpansionDepth        = 3
            };

            return(EntityFrameworkApi <TeamWorkDbContext> .ConfigureApi(apiType, services)
                   //自定义查询设置
                   .AddSingleton <ODataValidationSettings>(validationSettingFactory)
                   //定制查询授权逻辑,改为WebApi授权机制
                   //.AddService<IQueryExpressionAuthorizer, QueryCustomizedAuthorizer>()
                   //定制查询过程逻辑
                   ////.AddService<IQueryExpressionProcessor, QueryCustomizedProcessor>()
                   //定制提交授权逻辑
                   //.AddService<IChangeSetItemAuthorizer, SubmitCustomizedAuthorizer>()
                   //定制提交过程逻辑
                   .AddService <IChangeSetItemFilter, SubmitCustomizedFilter>());
        }
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     return(EntityFrameworkApi <NorthwindContext> .ConfigureApi(apiType, services)
            .AddService <IModelBuilder, NorthwindModelExtender>()
            .AddSingleton <ODataUriResolver>(new UnqualifiedODataUriResolver()));
 }
Exemple #7
0
 protected static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     return(EntityFrameworkApi <SpatialModel> .ConfigureApi(apiType, services)
            .AddService <IModelBuilder, SpatialModelExtender>()
            .AddSingleton <ODataSerializerProvider, CustomizedSerializerProvider>());
 }
Exemple #8
0
 protected static new IServiceCollection ConfigureApi(Type apType, IServiceCollection services)
 {
     return(EntityFrameworkApi <SpatialModel> .ConfigureApi(apType, services)
            .AddService <IModelBuilder, SpatialModelExtender>());
 }
Exemple #9
0
 public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services)
 {
     return(EntityFrameworkApi <NorthwindContext> .ConfigureApi(apiType, services)
            .AddService <IModelBuilder, NorthwindModelExtender>());
 }