Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion VB/WebDashboardAspNetCore3.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29403.142
MinimumVisualStudioVersion = 10.0.40219.1
Expand Down
39 changes: 18 additions & 21 deletions VB/WebDashboardAspNetCore3/Controllers/HomeController.vb
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Linq
Imports System.Threading.Tasks
Imports Microsoft.AspNetCore.Mvc
Imports Microsoft.Extensions.Logging
Imports WebDashboardAspNetCore3.Models

Namespace WebDashboardAspNetCore3.Controllers
Public Class HomeController
Inherits Controller

Private ReadOnly _logger As ILogger(Of HomeController)
Public Class HomeController
Inherits Controller

Public Sub New(ByVal logger As ILogger(Of HomeController))
_logger = logger
End Sub
Private ReadOnly _logger As ILogger(Of HomeController)

Public Function Index() As IActionResult
Return View()
End Function
Public Sub New(ByVal logger As ILogger(Of HomeController))
_logger = logger
End Sub

Public Function Privacy() As IActionResult
Return View()
End Function
Public Function Index() As IActionResult
Return View()
End Function

<ResponseCache(Duration := 0, Location := ResponseCacheLocation.None, NoStore := True)>
Public Function [Error]() As IActionResult
Return View(New ErrorViewModel With {.RequestId = If(Activity.Current?.Id, HttpContext.TraceIdentifier)})
End Function
End Class
Public Function Privacy() As IActionResult
Return View()
End Function

<ResponseCache(Duration:=0, Location:=ResponseCacheLocation.None, NoStore:=True)>
Public Function [Error]() As IActionResult
Return View(New ErrorViewModel With {.RequestId = If(Activity.Current?.Id, HttpContext.TraceIdentifier)})
End Function
End Class
End Namespace
20 changes: 10 additions & 10 deletions VB/WebDashboardAspNetCore3/Models/ErrorViewModel.vb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Imports System

Namespace WebDashboardAspNetCore3.Models
Public Class ErrorViewModel
Public Property RequestId() As String

Public ReadOnly Property ShowRequestId() As Boolean
Get
Return Not String.IsNullOrEmpty(RequestId)
End Get
End Property
End Class
Public Class ErrorViewModel

Public Property RequestId As String

Public ReadOnly Property ShowRequestId As Boolean
Get
Return Not String.IsNullOrEmpty(RequestId)
End Get
End Property
End Class
End Namespace
26 changes: 10 additions & 16 deletions VB/WebDashboardAspNetCore3/Program.vb
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Imports Microsoft.AspNetCore.Hosting
Imports Microsoft.Extensions.Configuration
Imports Microsoft.Extensions.Hosting
Imports Microsoft.Extensions.Logging

Namespace WebDashboardAspNetCore3
Public Class Program
Public Shared Sub Main(ByVal args() As String)
CreateHostBuilder(args).Build().Run()
End Sub

Public Shared Function CreateHostBuilder(ByVal args() As String) As IHostBuilder
Return Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(Sub(webBuilder)
webBuilder.UseStartup(Of Startup)()
End Sub)
End Function
End Class
Public Class Program

Public Shared Sub Main(ByVal args As String())
Call CreateHostBuilder(args).Build().Run()
End Sub

Public Shared Function CreateHostBuilder(ByVal args As String()) As IHostBuilder
Return Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(Sub(webBuilder) webBuilder.UseStartup(Of Startup)())
End Function
End Class
End Namespace
81 changes: 42 additions & 39 deletions VB/WebDashboardAspNetCore3/Startup.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Imports DevExpress.AspNetCore
Imports DevExpress.AspNetCore
Imports DevExpress.DashboardAspNetCore
Imports DevExpress.DashboardWeb
Imports Microsoft.AspNetCore.Builder
Expand All @@ -9,42 +9,45 @@ Imports Microsoft.Extensions.FileProviders
Imports Microsoft.Extensions.Hosting

Namespace WebDashboardAspNetCore3
Public Class Startup
'INSTANT VB NOTE: The variable configuration was renamed since Visual Basic does not handle local variables named the same as class members well:
Public Sub New(ByVal configuration_Conflict As IConfiguration, ByVal hostingEnvironment As IWebHostEnvironment)
Me.Configuration = configuration_Conflict
FileProvider = hostingEnvironment.ContentRootFileProvider
End Sub

Public ReadOnly Property Configuration() As IConfiguration
Public ReadOnly Property FileProvider() As IFileProvider

' This method gets called by the runtime. Use this method to add services to the container.
Public Sub ConfigureServices(ByVal services As IServiceCollection)
services.AddDevExpressControls().AddControllersWithViews().AddDefaultDashboardController(Sub(configurator)
configurator.SetDashboardStorage(New DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath))
configurator.SetConnectionStringsProvider(New DashboardConnectionStringsProvider(Configuration))
End Sub)
End Sub

' This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Public Sub Configure(ByVal app As IApplicationBuilder, ByVal env As IWebHostEnvironment)
If env.IsDevelopment() Then
app.UseDeveloperExceptionPage()
Else
app.UseExceptionHandler("/Home/Error")
' The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts()
End If
app.UseHttpsRedirection()
app.UseStaticFiles()
app.UseDevExpressControls()
app.UseRouting()
app.UseAuthorization()
app.UseEndpoints(Sub(endpoints)
EndpointRouteBuilderExtension.MapDashboardRoute(endpoints, "api/dashboards")
endpoints.MapControllerRoute(name:= "default", pattern:= "{controller=Home}/{action=Index}/{id?}")
End Sub)
End Sub
End Class

Public Class Startup

Public Sub New(ByVal configuration As IConfiguration, ByVal hostingEnvironment As IWebHostEnvironment)
Me.Configuration = configuration
FileProvider = hostingEnvironment.ContentRootFileProvider
End Sub

Public ReadOnly Property Configuration As IConfiguration

Public ReadOnly Property FileProvider As IFileProvider

' This method gets called by the runtime. Use this method to add services to the container.
Public Sub ConfigureServices(ByVal services As IServiceCollection)
services.AddDevExpressControls().AddControllersWithViews().AddDefaultDashboardController(Sub(configurator)
configurator.SetDashboardStorage(New DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath))
configurator.SetConnectionStringsProvider(New DashboardConnectionStringsProvider(Configuration))
End Sub)
End Sub

' This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Public Sub Configure(ByVal app As IApplicationBuilder, ByVal env As IWebHostEnvironment)
If env.IsDevelopment() Then
app.UseDeveloperExceptionPage()
Else
app.UseExceptionHandler("/Home/Error")
' The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts()
End If

app.UseHttpsRedirection()
app.UseStaticFiles()
app.UseDevExpressControls()
app.UseRouting()
app.UseAuthorization()
app.UseEndpoints(Sub(endpoints)
EndpointRouteBuilderExtension.MapDashboardRoute(endpoints, "api/dashboards")
endpoints.MapControllerRoute(name:="default", pattern:="{controller=Home}/{action=Index}/{id?}")
End Sub)
End Sub
End Class
End Namespace
10 changes: 3 additions & 7 deletions VB/WebDashboardAspNetCore3/WebDashboardAspNetCore3.vbproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<RootNamespace />
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="3.0.415" />
<PackageReference Include="DevExpress.AspNetCore.Dashboard" Version="19.1.13" />
<PackageReference Include="DevExpress.AspNetCore.Dashboard" Version="19.1.14" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\Dashboards\" />
</ItemGroup>
</Project>
</Project>
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/215337829/19.1.7%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T827756)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
<!-- default badges end -->
Expand Down