// @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); }
// 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); }
public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services) { EntityFrameworkApi <LibraryContext> .ConfigureApi(apiType, services); services.AddService <IModelBuilder, ModelBuilder>(); return(services); }
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>()); }
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())); }
protected static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services) { return(EntityFrameworkApi <SpatialModel> .ConfigureApi(apiType, services) .AddService <IModelBuilder, SpatialModelExtender>() .AddSingleton <ODataSerializerProvider, CustomizedSerializerProvider>()); }
protected static new IServiceCollection ConfigureApi(Type apType, IServiceCollection services) { return(EntityFrameworkApi <SpatialModel> .ConfigureApi(apType, services) .AddService <IModelBuilder, SpatialModelExtender>()); }
public static new IServiceCollection ConfigureApi(Type apiType, IServiceCollection services) { return(EntityFrameworkApi <NorthwindContext> .ConfigureApi(apiType, services) .AddService <IModelBuilder, NorthwindModelExtender>()); }