public ApiCallHandler( LiteAdminOptions options, IServiceProvider serviceProvider, ISchemaRepository schemaRepository) { _options = options ?? throw new ArgumentNullException(nameof(options)); _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _schemaRepository = schemaRepository ?? throw new ArgumentNullException(nameof(schemaRepository)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(); LiteAdminOptions options = new LiteAdminOptions { Tables = new string[] { "Cars", "Garages", "Test", "Category" }, CustomJavaScriptUrl = "/js/custom.js" }; services.AddLiteAdmin(@"Server=.\SQLExpress;Database=Example;Trusted_Connection=True", options); }
public static IServiceCollection AddLiteAdmin(this IServiceCollection services, string connectionString, LiteAdminOptions options) { options = options ?? new LiteAdminOptions(); options.Tables = options.Tables ?? new List <string>(); services.AddTransient(s => options); services.AddTransient <ISchemaRepository>(s => new SchemaRepository(connectionString, options.Tables)); services.AddTransient <IDatabaseRepository>(s => new DatabaseRepository(connectionString)); services.AddTransient <IApiCallHandler, ApiCallHandler>(); services.AddTransient <IStaticFileHandler, StaticFileHandler>(); services.AddTransient <ITableCallHandler, TableCallHandler>(); services.AddTransient <ISchemaHandler, SchemaHandler>(); services.AddTransient <ILookupCallHandler, LookupCallHandler>(); return(services); }
public StaticFileHandler(LiteAdminOptions options) { Options = options; }