Skip to content

Commit 2b05691

Browse files
DevExpressExampleBotDevExpressExampleBot
authored andcommitted
Source auto update [skip ci]
1 parent 8749d2c commit 2b05691

16 files changed

+1071
-1069
lines changed

CS/AspNetWebFormsDataFederation/AspNetWebFormsDataFederation.csproj

Lines changed: 201 additions & 200 deletions
Large diffs are not rendered by default.

CS/AspNetWebFormsDataFederation/Web.config

Lines changed: 120 additions & 120 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<packages>
3-
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
4-
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
5-
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.113.3" targetFramework="net472" />
6-
<package id="System.Data.SQLite" version="1.0.113.6" targetFramework="net472" />
7-
<package id="System.Data.SQLite.Core" version="1.0.113.6" targetFramework="net472" />
8-
<package id="System.Data.SQLite.EF6" version="1.0.113.0" targetFramework="net472" />
9-
<package id="System.Data.SQLite.Linq" version="1.0.113.0" targetFramework="net472" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
4+
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
5+
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.113.3" targetFramework="net472" />
6+
<package id="System.Data.SQLite" version="1.0.113.6" targetFramework="net472" />
7+
<package id="System.Data.SQLite.Core" version="1.0.113.6" targetFramework="net472" />
8+
<package id="System.Data.SQLite.EF6" version="1.0.113.0" targetFramework="net472" />
9+
<package id="System.Data.SQLite.Linq" version="1.0.113.0" targetFramework="net472" />
1010
</packages>

VB/AspNetWebFormsDataFederation/AspNetWebFormsDataFederation.vbproj

Lines changed: 203 additions & 202 deletions
Large diffs are not rendered by default.

VB/AspNetWebFormsDataFederation/Default.aspx.designer.vb

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
1-
Imports System
2-
Imports System.Web.Hosting
3-
Imports DevExpress.DashboardCommon
4-
Imports DevExpress.DashboardWeb
5-
Imports DevExpress.DataAccess.DataFederation
6-
Imports DevExpress.DataAccess.Excel
7-
Imports DevExpress.DataAccess.Json
8-
Imports DevExpress.DataAccess.Sql
9-
10-
Namespace AspNetWebFormsDataFederation
11-
12-
Public Partial Class [Default]
13-
Inherits Web.UI.Page
14-
15-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
16-
Dim dashboardFileStorage As DashboardFileStorage = New DashboardFileStorage("~/App_Data/Dashboards")
17-
ASPxDashboard1.SetDashboardStorage(dashboardFileStorage)
18-
' Uncomment this string to allow end users to create new data sources based on predefined connection strings.
19-
'ASPxDashboard1.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());
20-
Dim dataSourceStorage As DataSourceInMemoryStorage = New DataSourceInMemoryStorage()
21-
' Configures an SQL data source.
22-
Dim sqlDataSource As DashboardSqlDataSource = New DashboardSqlDataSource("SQL Data Source", "NWindConnectionString")
23-
Dim query As SelectQuery = SelectQueryFluentBuilder.AddTable("Orders").SelectAllColumnsFromTable().Build("SQL Orders")
24-
sqlDataSource.Queries.Add(query)
25-
' Configures an Object data source.
26-
Dim objDataSource As DashboardObjectDataSource = New DashboardObjectDataSource("Object Data Source")
27-
objDataSource.DataId = "odsInvoices"
28-
' Configures an Excel data source.
29-
Dim excelDataSource As DashboardExcelDataSource = New DashboardExcelDataSource("Excel Data Source")
30-
excelDataSource.ConnectionName = "excelSales"
31-
excelDataSource.FileName = HostingEnvironment.MapPath("~/App_Data/SalesPerson.xlsx")
32-
excelDataSource.SourceOptions = New ExcelSourceOptions(New ExcelWorksheetSettings("Data"))
33-
' Configures a JSON data source.
34-
Dim jsonDataSource As DashboardJsonDataSource = New DashboardJsonDataSource("JSON Data Source")
35-
jsonDataSource.ConnectionName = "jsonCategories"
36-
Dim fileUri As Uri = New Uri(HostingEnvironment.MapPath("~/App_Data/Categories.json"), UriKind.RelativeOrAbsolute)
37-
jsonDataSource.JsonSource = New UriJsonSource(fileUri)
38-
' Registers a Federated data source.
39-
dataSourceStorage.RegisterDataSource("federatedDataSource", CreateFederatedDataSource(sqlDataSource, excelDataSource, objDataSource, jsonDataSource).SaveToXml())
40-
ASPxDashboard1.SetDataSourceStorage(dataSourceStorage)
41-
End Sub
42-
43-
Protected Sub ASPxDashboard1_ConfigureDataConnection(ByVal sender As Object, ByVal e As ConfigureDataConnectionWebEventArgs)
44-
If Equals(e.ConnectionName, "excelSales") Then
45-
TryCast(e.ConnectionParameters, ExcelDataSourceConnectionParameters).FileName = HostingEnvironment.MapPath("~/App_Data/SalesPerson.xlsx")
46-
ElseIf Equals(e.ConnectionName, "jsonCategories") Then
47-
e.ConnectionParameters = New JsonSourceConnectionParameters() With {.JsonSource = New UriJsonSource(New Uri(HostingEnvironment.MapPath("~/App_Data/Categories.json"), UriKind.RelativeOrAbsolute))}
48-
End If
49-
End Sub
50-
51-
Protected Sub DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
52-
If Equals(e.DataId, "odsInvoices") Then
53-
e.Data = Invoices.CreateData()
54-
End If
55-
End Sub
56-
57-
Private Shared Function CreateFederatedDataSource(ByVal sqlDS As DashboardSqlDataSource, ByVal excelDS As DashboardExcelDataSource, ByVal objDS As DashboardObjectDataSource, ByVal jsonDS As DashboardJsonDataSource) As DashboardFederationDataSource
58-
Dim federationDataSource As DashboardFederationDataSource = New DashboardFederationDataSource("Federated Data Source")
59-
Dim sqlSource As Source = New Source("sqlSource", sqlDS, "SQL Orders")
60-
Dim excelSource As Source = New Source("excelSource", excelDS, "")
61-
Dim objectSource As Source = New Source("objectSource", objDS, "")
62-
Dim jsonSourceNode As SourceNode = New SourceNode(New Source("json", jsonDS, ""))
63-
' Join
64-
Dim joinQuery As SelectNode = sqlSource.From().Select("OrderDate", "ShipCity", "ShipCountry").Join(excelSource, "[excelSource.OrderID] = [sqlSource.OrderID]").Select("CategoryName", "ProductName", "Extended Price").Join(objectSource, "[objectSource.Country] = [excelSource.Country]").Select("Country", "UnitPrice").Build("Join query")
65-
federationDataSource.Queries.Add(joinQuery)
66-
' Union and UnionAll
67-
Dim queryUnionAll As UnionNode = sqlSource.From().Select("OrderID", "OrderDate").Build("OrdersSqlite").UnionAll(excelSource.From().Select("OrderID", "OrderDate").Build("OrdersExcel")).Build("OrdersUnionAll")
68-
queryUnionAll.Alias = "Union query"
69-
Dim queryUnion As UnionNode = sqlSource.From().Select("OrderID", "OrderDate").Build("OrdersSqlite").Union(excelSource.From().Select("OrderID", "OrderDate").Build("OrdersExcel")).Build("OrdersUnion")
70-
queryUnion.Alias = "UnionAll query"
71-
federationDataSource.Queries.Add(queryUnionAll)
72-
federationDataSource.Queries.Add(queryUnion)
73-
' Transformation
74-
Dim unfoldNode As TransformationNode = New TransformationNode(jsonSourceNode) With {.[Alias] = "Unfold"}
75-
Dim unfoldFlattenNode As TransformationNode = New TransformationNode(jsonSourceNode) With {.[Alias] = "Unfold and Flatten"}
76-
federationDataSource.Queries.Add(unfoldNode)
77-
federationDataSource.Queries.Add(unfoldFlattenNode)
78-
Return federationDataSource
79-
End Function
80-
End Class
81-
End Namespace
1+
Imports System
2+
Imports System.Web.Hosting
3+
Imports DevExpress.DashboardCommon
4+
Imports DevExpress.DashboardWeb
5+
Imports DevExpress.DataAccess.DataFederation
6+
Imports DevExpress.DataAccess.Excel
7+
Imports DevExpress.DataAccess.Json
8+
Imports DevExpress.DataAccess.Sql
9+
10+
Namespace AspNetWebFormsDataFederation
11+
12+
Public Partial Class [Default]
13+
Inherits Web.UI.Page
14+
15+
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
16+
Dim dashboardFileStorage As DashboardFileStorage = New DashboardFileStorage("~/App_Data/Dashboards")
17+
ASPxDashboard1.SetDashboardStorage(dashboardFileStorage)
18+
' Uncomment this string to allow end users to create new data sources based on predefined connection strings.
19+
'ASPxDashboard1.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());
20+
Dim dataSourceStorage As DataSourceInMemoryStorage = New DataSourceInMemoryStorage()
21+
' Configures an SQL data source.
22+
Dim sqlDataSource As DashboardSqlDataSource = New DashboardSqlDataSource("SQL Data Source", "NWindConnectionString")
23+
Dim query As SelectQuery = SelectQueryFluentBuilder.AddTable("Orders").SelectAllColumnsFromTable().Build("SQL Orders")
24+
sqlDataSource.Queries.Add(query)
25+
' Configures an Object data source.
26+
Dim objDataSource As DashboardObjectDataSource = New DashboardObjectDataSource("Object Data Source")
27+
objDataSource.DataId = "odsInvoices"
28+
' Configures an Excel data source.
29+
Dim excelDataSource As DashboardExcelDataSource = New DashboardExcelDataSource("Excel Data Source")
30+
excelDataSource.ConnectionName = "excelSales"
31+
excelDataSource.FileName = HostingEnvironment.MapPath("~/App_Data/SalesPerson.xlsx")
32+
excelDataSource.SourceOptions = New ExcelSourceOptions(New ExcelWorksheetSettings("Data"))
33+
' Configures a JSON data source.
34+
Dim jsonDataSource As DashboardJsonDataSource = New DashboardJsonDataSource("JSON Data Source")
35+
jsonDataSource.ConnectionName = "jsonCategories"
36+
Dim fileUri As Uri = New Uri(HostingEnvironment.MapPath("~/App_Data/Categories.json"), UriKind.RelativeOrAbsolute)
37+
jsonDataSource.JsonSource = New UriJsonSource(fileUri)
38+
' Registers a Federated data source.
39+
dataSourceStorage.RegisterDataSource("federatedDataSource", CreateFederatedDataSource(sqlDataSource, excelDataSource, objDataSource, jsonDataSource).SaveToXml())
40+
ASPxDashboard1.SetDataSourceStorage(dataSourceStorage)
41+
End Sub
42+
43+
Protected Sub ASPxDashboard1_ConfigureDataConnection(ByVal sender As Object, ByVal e As ConfigureDataConnectionWebEventArgs)
44+
If Equals(e.ConnectionName, "excelSales") Then
45+
TryCast(e.ConnectionParameters, ExcelDataSourceConnectionParameters).FileName = HostingEnvironment.MapPath("~/App_Data/SalesPerson.xlsx")
46+
ElseIf Equals(e.ConnectionName, "jsonCategories") Then
47+
e.ConnectionParameters = New JsonSourceConnectionParameters() With {.JsonSource = New UriJsonSource(New Uri(HostingEnvironment.MapPath("~/App_Data/Categories.json"), UriKind.RelativeOrAbsolute))}
48+
End If
49+
End Sub
50+
51+
Protected Sub DataLoading(ByVal sender As Object, ByVal e As DataLoadingWebEventArgs)
52+
If Equals(e.DataId, "odsInvoices") Then
53+
e.Data = Invoices.CreateData()
54+
End If
55+
End Sub
56+
57+
Private Shared Function CreateFederatedDataSource(ByVal sqlDS As DashboardSqlDataSource, ByVal excelDS As DashboardExcelDataSource, ByVal objDS As DashboardObjectDataSource, ByVal jsonDS As DashboardJsonDataSource) As DashboardFederationDataSource
58+
Dim federationDataSource As DashboardFederationDataSource = New DashboardFederationDataSource("Federated Data Source")
59+
Dim sqlSource As Source = New Source("sqlSource", sqlDS, "SQL Orders")
60+
Dim excelSource As Source = New Source("excelSource", excelDS, "")
61+
Dim objectSource As Source = New Source("objectSource", objDS, "")
62+
Dim jsonSourceNode As SourceNode = New SourceNode(New Source("json", jsonDS, ""))
63+
' Join
64+
Dim joinQuery As SelectNode = sqlSource.From().Select("OrderDate", "ShipCity", "ShipCountry").Join(excelSource, "[excelSource.OrderID] = [sqlSource.OrderID]").Select("CategoryName", "ProductName", "Extended Price").Join(objectSource, "[objectSource.Country] = [excelSource.Country]").Select("Country", "UnitPrice").Build("Join query")
65+
federationDataSource.Queries.Add(joinQuery)
66+
' Union and UnionAll
67+
Dim queryUnionAll As UnionNode = sqlSource.From().Select("OrderID", "OrderDate").Build("OrdersSqlite").UnionAll(excelSource.From().Select("OrderID", "OrderDate").Build("OrdersExcel")).Build("OrdersUnionAll")
68+
queryUnionAll.Alias = "Union query"
69+
Dim queryUnion As UnionNode = sqlSource.From().Select("OrderID", "OrderDate").Build("OrdersSqlite").Union(excelSource.From().Select("OrderID", "OrderDate").Build("OrdersExcel")).Build("OrdersUnion")
70+
queryUnion.Alias = "UnionAll query"
71+
federationDataSource.Queries.Add(queryUnionAll)
72+
federationDataSource.Queries.Add(queryUnion)
73+
' Transformation
74+
Dim unfoldNode As TransformationNode = New TransformationNode(jsonSourceNode) With {.[Alias] = "Unfold"}
75+
Dim unfoldFlattenNode As TransformationNode = New TransformationNode(jsonSourceNode) With {.[Alias] = "Unfold and Flatten"}
76+
federationDataSource.Queries.Add(unfoldNode)
77+
federationDataSource.Queries.Add(unfoldFlattenNode)
78+
Return federationDataSource
79+
End Function
80+
End Class
81+
End Namespace

0 commit comments

Comments
 (0)