public CustomDataSourceStorage() { DashboardSqlDataSource sqlDataSource1 = new DashboardSqlDataSource(sqlDataSourceId1, "NorthwindConnectionString"); SelectQuery query1 = SelectQueryFluentBuilder .AddTable("Categories") .SelectAllColumnsFromTable() .Build("Categories"); sqlDataSource1.Queries.Add(query1); SelectQuery query2 = SelectQueryFluentBuilder .AddTable("Products") .SelectAllColumnsFromTable() .Build("Products"); sqlDataSource1.Queries.Add(query2); DashboardSqlDataSource sqlDataSource2 = new DashboardSqlDataSource(sqlDataSourceId2, "CarsXtraSchedulingConnectionString"); SelectQuery query = SelectQueryFluentBuilder .AddTable("Cars") .SelectAllColumnsFromTable() .Build("Cars"); sqlDataSource2.Queries.Add(query); DashboardJsonDataSource jsonDataSource = new DashboardJsonDataSource(jsonDataSourceId); jsonDataSource.JsonSource = new UriJsonSource(new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")); jsonDataSource.RootElement = "Customers"; documents[sqlDataSourceId1] = new XDocument(sqlDataSource1.SaveToXml()); documents[sqlDataSourceId2] = new XDocument(sqlDataSource2.SaveToXml()); documents[jsonDataSourceId] = new XDocument(jsonDataSource.SaveToXml()); }
public void ConfigureServices(IServiceCollection services) { services.AddResponseCompression(opts => { opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( new[] { "application/octet-stream" }); }); services.AddDevExpressControls(); services.AddMvc() .AddDefaultDashboardController(configurator => { // Register Dashboard Storage configurator.SetDashboardStorage(new DashboardFileStorage(_physicalProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath)); // Create a sample JSON data source DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); DashboardJsonDataSource jsonDataSourceUrl = new DashboardJsonDataSource("JSON Data Source (URL)"); jsonDataSourceUrl.JsonSource = new UriJsonSource(new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")); jsonDataSourceUrl.RootElement = "Customers"; jsonDataSourceUrl.Fill(); dataSourceStorage.RegisterDataSource("jsonDataSourceUrl", jsonDataSourceUrl.SaveToXml()); configurator.SetDataSourceStorage(dataSourceStorage); configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration)); configurator.AllowExecutingCustomSql = true; }); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddSingleton <WeatherForecastService>(); }
public static void ConfigureDataSource(DashboardConfigurator configurator, DataSourceInMemoryStorage storage, IFileProvider fileProvider) { // Registers a JSON data source from URL. DashboardJsonDataSource jsonDataSourceUrl = new DashboardJsonDataSource("JSON Data Source (URL)"); jsonDataSourceUrl.JsonSource = new UriJsonSource(new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")); jsonDataSourceUrl.RootElement = "Customers"; jsonDataSourceUrl.Fill(); storage.RegisterDataSource("jsonDataSourceUrl", jsonDataSourceUrl.SaveToXml()); // Registers a JSON data source from a JSON file. DashboardJsonDataSource jsonDataSourceFile = new DashboardJsonDataSource("JSON Data Source (File)"); jsonDataSourceFile.ConnectionName = "jsonConnection"; jsonDataSourceFile.RootElement = "Customers"; storage.RegisterDataSource("jsonDataSourceFile", jsonDataSourceFile.SaveToXml()); // Registers a JSON data source from JSON string. DashboardJsonDataSource jsonDataSourceString = new DashboardJsonDataSource("JSON Data Source (String)"); string json = "{\"Customers\":[{\"Id\":\"ALFKI\",\"CompanyName\":\"Alfreds Futterkiste\",\"ContactName\":\"Maria Anders\",\"ContactTitle\":\"Sales Representative\",\"Address\":\"Obere Str. 57\",\"City\":\"Berlin\",\"PostalCode\":\"12209\",\"Country\":\"Germany\",\"Phone\":\"030-0074321\",\"Fax\":\"030-0076545\"}],\"ResponseStatus\":{}}"; jsonDataSourceString.JsonSource = new CustomJsonSource(json); jsonDataSourceString.RootElement = "Customers"; storage.RegisterDataSource("jsonDataSourceString", jsonDataSourceString.SaveToXml()); JsonDataSourceConfigurator.fileProvider = fileProvider; configurator.ConfigureDataConnection += Configurator_ConfigureDataConnection; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddMvc() .AddDefaultDashboardController(configurator => { // Register Dashboard Storage configurator.SetDashboardStorage(new DashboardFileStorage(_physicalProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath)); // Create a sample JSON data source DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); DashboardJsonDataSource jsonDataSourceUrl = new DashboardJsonDataSource("JSON Data Source (URL)"); jsonDataSourceUrl.JsonSource = new UriJsonSource(new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")); jsonDataSourceUrl.RootElement = "Customers"; jsonDataSourceUrl.Fill(); dataSourceStorage.RegisterDataSource("jsonDataSourceUrl", jsonDataSourceUrl.SaveToXml()); configurator.SetDataSourceStorage(dataSourceStorage); configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration)); configurator.AllowExecutingCustomSql = true; }); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddHttpContextAccessor(); services.AddSingleton <XpoDataStoreProviderAccessor>(); services.AddScoped <CircuitHandler, CircuitHandlerProxy>(); services.AddXaf <XAFBlazorDashboardsBlazorApplication>(Configuration); }
public DataSourceInMemoryStorage CreateDataSourceStorage() { DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); DashboardJsonDataSource jsonDataSource = new DashboardJsonDataSource("Customers"); jsonDataSource.RootElement = "Customers"; dataSourceStorage.RegisterDataSource("jsonDataSourceSupport", jsonDataSource.SaveToXml()); return(dataSourceStorage); }
public DataSourceInMemoryStorage CreateDataSourceStorage() { DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); DashboardJsonDataSource jsonDataSourceSupport = new DashboardJsonDataSource("Support"); jsonDataSourceSupport.RootElement = "Employee"; dataSourceStorage.RegisterDataSource("jsonDataSourceSupport", jsonDataSourceSupport.SaveToXml()); DashboardJsonDataSource jsonDataSourceCategories = new DashboardJsonDataSource("Categories"); //jsonDataSourceCategories.RootElement = ""; dataSourceStorage.RegisterDataSource("jsonDataSourceCategories", jsonDataSourceCategories.SaveToXml()); return(dataSourceStorage); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddResponseCompression(opts => { opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( new[] { "application/octet-stream" }); }); services.AddDevExpressControls(); services.AddMvc().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null) .AddDefaultDashboardController(configurator => { // Register Dashboard Storage configurator.SetDashboardStorage(new DashboardFileStorage(_physicalProvider.GetFileInfo("AppData/Dashboards").PhysicalPath)); // Create a sample JSON data source DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); DashboardJsonDataSource jsonDataSourceUrl = new DashboardJsonDataSource("JSON Data Source (URL)"); jsonDataSourceUrl.JsonSource = new UriJsonSource(new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")); jsonDataSourceUrl.RootElement = "Customers"; jsonDataSourceUrl.Fill(); dataSourceStorage.RegisterDataSource("jsonDataSourceUrl", jsonDataSourceUrl.SaveToXml()); configurator.SetDataSourceStorage(dataSourceStorage); configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration)); configurator.AllowExecutingCustomSql = true; }); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddHttpContextAccessor(); services.AddSingleton <XpoDataStoreProviderAccessor>(); services.AddScoped <CircuitHandler, CircuitHandlerProxy>(); services.AddXaf <SonTungERPBlazorApplication>(Configuration); services.AddXafReporting(); services.AddXafSecurity(options => { options.RoleType = typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyRole); options.UserType = typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyUser); options.Events.OnSecurityStrategyCreated = securityStrategy => ((SecurityStrategy)securityStrategy).RegisterXPOAdapterProviders(); options.SupportNavigationPermissionsForTypes = false; }).AddExternalAuthentication <HttpContextPrincipalProvider>() .AddAuthenticationStandard(options => { options.IsSupportChangePassword = true; }); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options => { options.LoginPath = "/LoginPage"; }); }
public CustomDataSourceStorage() { DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource(sqlDataSourceId, "sqlCategories"); SelectQuery query = SelectQueryFluentBuilder .AddTable("Categories") .SelectAllColumnsFromTable() .Build("Categories"); query.Parameters.Add(new QueryParameter("CategoryNameStartsWith", typeof(DevExpress.DataAccess.Expression), new DevExpress.DataAccess.Expression("[Parameters.CategoryPattern]"))); sqlDataSource.Queries.Add(query); DashboardJsonDataSource jsonDataSource = new DashboardJsonDataSource(jsonDataSourceId) { RootElement = "Customers", ConnectionName = "jsonCustomers" }; DashboardObjectDataSource objDataSource = new DashboardObjectDataSource(odsDataSourceId) { DataId = "odsSales" }; DashboardOlapDataSource olapDataSource = new DashboardOlapDataSource(olapDataSourceId, "olapAdventureWorks"); DashboardExtractDataSource extractDataSource = new DashboardExtractDataSource(extractDataSourceId) { ConnectionName = "extractSalesPerson" }; DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource(excelDataSourceId) { ConnectionName = "excelSales", SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1")) }; DashboardEFDataSource efDataSource = new DashboardEFDataSource(efDataSourceId, new EFConnectionParameters(typeof(NorthwindDbContext))); documents[sqlDataSourceId] = new XDocument(sqlDataSource.SaveToXml()); documents[jsonDataSourceId] = new XDocument(jsonDataSource.SaveToXml()); documents[odsDataSourceId] = new XDocument(objDataSource.SaveToXml()); documents[olapDataSourceId] = new XDocument(olapDataSource.SaveToXml()); documents[extractDataSourceId] = new XDocument(extractDataSource.SaveToXml()); documents[excelDataSourceId] = new XDocument(excelDataSource.SaveToXml()); documents[efDataSourceId] = new XDocument(efDataSource.SaveToXml()); }
protected void Page_Load(object sender, EventArgs e) { DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards"); ASPxDashboardJson.SetDashboardStorage(dashboardFileStorage); // Uncomment the next line to allow users to create new data sources based on predefined connection strings. //ASPxDashboardJson.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider()); // Create a data source storage. DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); // Register a JSON data source from a URL. DashboardJsonDataSource jsonDataSourceUrl = new DashboardJsonDataSource("JSON Data Source (URL)"); jsonDataSourceUrl.ConnectionName = "jsonUrlConnection"; jsonDataSourceUrl.RootElement = "Employee"; dataSourceStorage.RegisterDataSource("jsonDataSourceUrl", jsonDataSourceUrl.SaveToXml()); // Register a JSON data source from a JSON file. DashboardJsonDataSource jsonDataSourceFile = new DashboardJsonDataSource("JSON Data Source (File)"); jsonDataSourceFile.ConnectionName = "jsonFileConnection"; jsonDataSourceFile.RootElement = "Customers"; dataSourceStorage.RegisterDataSource("jsonDataSourceFile", jsonDataSourceFile.SaveToXml()); // Register a JSON data source from a JSON string. DashboardJsonDataSource jsonDataSourceString = new DashboardJsonDataSource("JSON Data Source (String)"); jsonDataSourceString.ConnectionName = "jsonStringConnection"; jsonDataSourceString.RootElement = "Customers"; dataSourceStorage.RegisterDataSource("jsonDataSourceString", jsonDataSourceString.SaveToXml()); // Set the configured data source storage. ASPxDashboardJson.SetDataSourceStorage(dataSourceStorage); ASPxDashboardJson.ConfigureDataConnection += ASPxDashboardJson_ConfigureDataConnection; ASPxDashboardJson.InitialDashboardId = "dashboardJson"; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); services.AddServerSideBlazor(); services.AddMvc(); services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => { DashboardConfigurator configurator = new DashboardConfigurator(); // Register Dashboard Storage configurator.SetDashboardStorage(new DashboardFileStorage(FileProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath)); // Create a sample JSON data source DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); DashboardJsonDataSource jsonDataSourceUrl = new DashboardJsonDataSource("JSON Data Source (URL)"); jsonDataSourceUrl.JsonSource = new UriJsonSource( new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")); jsonDataSourceUrl.RootElement = "Customers"; dataSourceStorage.RegisterDataSource("jsonDataSourceUrl", jsonDataSourceUrl.SaveToXml()); configurator.SetDataSourceStorage(dataSourceStorage); return(configurator); }); }