/// <summary> /// Adds a rest data handler /// </summary> /// <param name="services">Services collection where to add the handler</param> /// <param name="options">Option of the handler</param> /// <returns>Services with the configured handler</returns> public static IServiceCollection AddRest4GP(this IServiceCollection services, Action <DataRequestOptions> options = null) { var opt = new DataRequestOptions(); if (options != null) { options.Invoke(opt); } services.AddMemoryCache(); services.AddTransient <DataRequestOptions>(x => opt); services.AddTransient <RestRouteMiddleware>(); return(services); }
/// <summary> /// Creates a new instance of SqlRestHandler /// </summary> /// <param name="root">Root of the request to handle</param> /// <param name="sqlOptions">Sql options</param> /// <param name="memoryCache">Memory cache implementation</param> /// <param name="options">Data option</param> public SqlRestHandler(string root, SqlDataOptions sqlOptions, IMemoryCache memoryCache, DataRequestOptions options) : base(root, new SqlDataContext(sqlOptions), memoryCache, options) { }
/// <summary> /// Creates a new instance of VisionRestHandler /// </summary> /// <param name="root">Root of the request to handle</param> /// <param name="memoryCache">Memory cache implementation</param> /// <param name="options">Data option</param> internal VisionRestHandler(string root, IMemoryCache memoryCache, DataRequestOptions options) : base(root, new VisionDataContext(VisionFileSystem.GetInstance()), memoryCache, options) { }