public static IServiceCollection AddCustomFlexGrid( this IServiceCollection services, Action <IModelConfiguration> configureGridComponents = null, Action <FlexGridOptions> configureOptions = null) { var modelBuilder = new ModelBuilder(); var flexGridOptions = new FlexGridOptions(); configureGridComponents?.Invoke(modelBuilder); configureOptions?.Invoke(flexGridOptions); flexGridOptions.IsServerSideBlazorApp = true; // hack services.AddLogging(builder => builder.AddConsole()); services.TryAddScoped(typeof(ILazyGroupableDataSetLoader <>), typeof(NullLazyGroupableDataSetLoader <>)); services.AddScoped <FlexGridInterop>(); services.AddScoped(typeof(LazyLoadedTableDataAdapter <>)); RegisterRendererTreeBuildersScoped(services); services.TryAddSingleton <IAuthorizationService, NullAuthorizationService>(); services.TryAddSingleton <ICurrentUserPermission>(new NullCurrentUserPermission()); services.AddSingleton(typeof(MasterTableDataAdapterBuilder <>)); services.AddSingleton(typeof(IGridConfigurationProvider), new GridConfigurationProvider(modelBuilder.Model)); services.AddSingleton <IMasterDetailTableDataSetFactory, MasterDetailTableDataSetFactory>(); services.AddSingleton <ConventionsSet>(); services.AddSingleton <ITypePropertyAccessorCache, PropertyValueAccessorCache>(); services.AddSingleton <IDetailDataAdapterVisitors, DetailDataAdapterVisitors>(); services.AddSingleton <ITableDataAdapterProvider, RunTimeTableDataAdapterProvider>(); RegisterFormInputBuilders(services); return(services); }
public static IServiceCollection AddFlexGrid( this IServiceCollection services, Action <IModelConfiguration> configureGridComponents = null, Action <FlexGridOptions> configureOptions = null) { var modelBuilder = new ModelBuilder(); var flexGridOptions = new FlexGridOptions(); configureGridComponents?.Invoke(modelBuilder); configureOptions?.Invoke(flexGridOptions); if (flexGridOptions.IsServerSideBlazorApp) { services.AddLogging(builder => builder.AddConsole()); services.TryAddScoped(typeof(ILazyDataSetLoader <>), typeof(NullLazyDataSetLoader <>)); services.TryAddScoped(typeof(ILazyDataSetItemManipulator <>), typeof(NullLazyDataSetItemManipulator <>)); services.TryAddScoped(typeof(ICreateItemHandle <,>), typeof(NullCreateItemHandler <,>)); services.TryAddScoped(typeof(ILazyGroupableDataSetLoader <>), typeof(NullLazyGroupableDataSetLoader <>)); services.AddScoped <FlexGridInterop>(); services.AddScoped(typeof(LazyLoadedTableDataAdapter <>)); RegisterRendererTreeBuildersScoped(services); } else { /*services.AddLogging(builder => builder * .AddBrowserConsole() * .SetMinimumLevel(LogLevel.Debug));*/ if (flexGridOptions.UseAuthorizationForHttpRequests) { services.AddSingleton <IHttpClientFactory, AuthorizationHttpClientFactory>(); } else { services.AddSingleton <IHttpClientFactory, DefaultHttpClientFactory>(); } services.AddSingleton(typeof(ILogger <>), typeof(NullLogger <>)); services.AddSingleton(typeof(ILazyDataSetLoader <>), typeof(HttpLazyDataSetLoader <>)); services.AddSingleton(typeof(ILazyDataSetItemManipulator <>), typeof(HttpLazyDataSetItemManipulator <>)); services.AddSingleton(typeof(ICreateItemHandle <,>), typeof(HttpCreateItemHandler <,>)); services.AddSingleton(typeof(ILazyGroupableDataSetLoader <>), typeof(HttpLazyGroupableDataSetLoader <>)); services.AddSingleton <FlexGridInterop>(); services.AddSingleton(typeof(LazyLoadedTableDataAdapter <>)); RegisterRendererTreeBuilders(services); } services.TryAddSingleton <IAuthorizationService, NullAuthorizationService>(); services.TryAddSingleton <ICurrentUserPermission>(new NullCurrentUserPermission()); services.AddSingleton(typeof(MasterTableDataAdapterBuilder <>)); services.AddSingleton(typeof(IGridConfigurationProvider), new GridConfigurationProvider(modelBuilder.Model)); services.AddSingleton <IMasterDetailTableDataSetFactory, MasterDetailTableDataSetFactory>(); services.AddSingleton <ConventionsSet>(); services.AddSingleton <ITypePropertyAccessorCache, PropertyValueAccessorCache>(); services.AddSingleton <IDetailDataAdapterVisitors, DetailDataAdapterVisitors>(); services.AddSingleton <ITableDataAdapterProvider, RunTimeTableDataAdapterProvider>(); RegisterFormInputBuilders(services); return(services); }
public static IServiceCollection AddFlexGrid( this IServiceCollection services, Action <IModelConfiguration> configureGridComponents = null, Action <FlexGridOptions> configureOptions = null) { var modelBuilder = new ModelBuilder(); var flexGridOptions = new FlexGridOptions(); configureGridComponents?.Invoke(modelBuilder); configureOptions?.Invoke(flexGridOptions); if (flexGridOptions.IsServerSideBlazorApp) { services.AddLogging(builder => builder.AddConsole()); } else { services.AddLogging(builder => builder .AddBrowserConsole() .SetMinimumLevel(LogLevel.Debug)); } services.TryAddSingleton <ICurrentUserPermission>(new NullCurrentUserPermission()); services.AddSingleton(typeof(ILazyDataSetLoader <>), typeof(HttpLazyDataSetLoader <>)); services.AddSingleton(typeof(ILazyDataSetItemManipulator <>), typeof(HttpLazyDataSetItemManipulator <>)); services.AddSingleton(typeof(MasterTableDataAdapterBuilder <>)); services.AddSingleton(typeof(LazyLoadedTableDataAdapter <>)); services.AddSingleton(typeof(IGridConfigurationProvider), new GridConfigurationProvider(modelBuilder.Model)); services.AddSingleton <IMasterDetailTableDataSetFactory, MasterDetailTableDataSetFactory>(); services.AddSingleton <ConventionsSet>(); services.AddSingleton <IPropertyValueAccessorCache, PropertyValueAccessorCache>(); services.AddSingleton <IDetailDataAdapterVisitors, DetailDataAdapterVisitors>(); services.AddSingleton <ITableDataAdapterProvider, RunTimeTableDataAdapterProvider>(); RegisterGridRendererTree(services); return(services); }