コード例 #1
0
ファイル: ApiCallHandler.cs プロジェクト: jgveire/LiteAdmin
 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));
 }
コード例 #2
0
ファイル: Startup.cs プロジェクト: jgveire/LiteAdmin
        // 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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public StaticFileHandler(LiteAdminOptions options)
 {
     Options = options;
 }