Skip to content

Commit afaccf2

Browse files
Basic passive rendering (#3)
1 parent d06bd3a commit afaccf2

34 files changed

+1410
-17
lines changed

AspNetCore.sln

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{74377D3E-E
17561756
EndProject
17571757
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.HttpSys.Microbenchmarks", "src\Servers\HttpSys\perf\Microbenchmarks\Microsoft.AspNetCore.Server.HttpSys.Microbenchmarks.csproj", "{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}"
17581758
EndProject
1759+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorUnitedApp", "src\Components\Samples\BlazorUnitedApp\BlazorUnitedApp.csproj", "{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}"
1760+
EndProject
17591761
Global
17601762
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17611763
Debug|Any CPU = Debug|Any CPU
@@ -10517,22 +10519,6 @@ Global
1051710519
{A8E2AB77-8F57-47C2-A961-2F316793CAFF}.Release|x64.Build.0 = Release|Any CPU
1051810520
{A8E2AB77-8F57-47C2-A961-2F316793CAFF}.Release|x86.ActiveCfg = Release|Any CPU
1051910521
{A8E2AB77-8F57-47C2-A961-2F316793CAFF}.Release|x86.Build.0 = Release|Any CPU
10520-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
10521-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
10522-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|arm64.ActiveCfg = Debug|Any CPU
10523-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|arm64.Build.0 = Debug|Any CPU
10524-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|x64.ActiveCfg = Debug|Any CPU
10525-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|x64.Build.0 = Debug|Any CPU
10526-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|x86.ActiveCfg = Debug|Any CPU
10527-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Debug|x86.Build.0 = Debug|Any CPU
10528-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
10529-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|Any CPU.Build.0 = Release|Any CPU
10530-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|arm64.ActiveCfg = Release|Any CPU
10531-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|arm64.Build.0 = Release|Any CPU
10532-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|x64.ActiveCfg = Release|Any CPU
10533-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|x64.Build.0 = Release|Any CPU
10534-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|x86.ActiveCfg = Release|Any CPU
10535-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD}.Release|x86.Build.0 = Release|Any CPU
1053610522
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1053710523
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
1053810524
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}.Debug|arm64.ActiveCfg = Debug|Any CPU
@@ -10549,6 +10535,22 @@ Global
1054910535
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}.Release|x64.Build.0 = Release|Any CPU
1055010536
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}.Release|x86.ActiveCfg = Release|Any CPU
1055110537
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB}.Release|x86.Build.0 = Release|Any CPU
10538+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
10539+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
10540+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|arm64.ActiveCfg = Debug|Any CPU
10541+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|arm64.Build.0 = Debug|Any CPU
10542+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|x64.ActiveCfg = Debug|Any CPU
10543+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|x64.Build.0 = Debug|Any CPU
10544+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|x86.ActiveCfg = Debug|Any CPU
10545+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Debug|x86.Build.0 = Debug|Any CPU
10546+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
10547+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|Any CPU.Build.0 = Release|Any CPU
10548+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|arm64.ActiveCfg = Release|Any CPU
10549+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|arm64.Build.0 = Release|Any CPU
10550+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|x64.ActiveCfg = Release|Any CPU
10551+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|x64.Build.0 = Release|Any CPU
10552+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|x86.ActiveCfg = Release|Any CPU
10553+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A}.Release|x86.Build.0 = Release|Any CPU
1055210554
EndGlobalSection
1055310555
GlobalSection(SolutionProperties) = preSolution
1055410556
HideSolutionNode = FALSE
@@ -11414,9 +11416,9 @@ Global
1141411416
{890B5210-48EF-488F-93A2-F13BCB07C780} = {4DA84F2B-1948-439B-85AB-E99E31331A9C}
1141511417
{A8E2AB77-8F57-47C2-A961-2F316793CAFF} = {890B5210-48EF-488F-93A2-F13BCB07C780}
1141611418
{F43CC5EA-6032-4A11-A9B2-6D48CB5EB082} = {4DA84F2B-1948-439B-85AB-E99E31331A9C}
11417-
{B6B74AC7-63AE-49E0-8283-C7B230BE12BD} = {33CAD745-5912-47D3-BAF3-5AE580FED275}
1141811419
{74377D3E-E0C6-41A4-89ED-11A9C00142A9} = {166E48ED-9738-4E13-8618-0D805F6F0F65}
1141911420
{3C7C65BF-0C13-418E-90BD-EC9C3CD282CB} = {74377D3E-E0C6-41A4-89ED-11A9C00142A9}
11421+
{09962BE7-48EC-44EA-B86A-3652FF0D7D1A} = {5FE1FBC1-8CE3-4355-9866-44FE1307C5F1}
1142011422
EndGlobalSection
1142111423
GlobalSection(ExtensibilityGlobals) = postSolution
1142211424
SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F}

src/Components/Components.slnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"src\\Components\\Forms\\src\\Microsoft.AspNetCore.Components.Forms.csproj",
1616
"src\\Components\\Forms\\test\\Microsoft.AspNetCore.Components.Forms.Tests.csproj",
1717
"src\\Components\\Samples\\BlazorServerApp\\BlazorServerApp.csproj",
18+
"src\\Components\\Samples\\BlazorUnitedApp\\BlazorUnitedApp.csproj",
1819
"src\\Components\\Server\\src\\Microsoft.AspNetCore.Components.Server.csproj",
1920
"src\\Components\\Server\\test\\Microsoft.AspNetCore.Components.Server.Tests.csproj",
2021
"src\\Components\\WebAssembly\\Authentication.Msal\\src\\Microsoft.Authentication.WebAssembly.Msal.csproj",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
5+
<IsShippingPackage>false</IsShippingPackage>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<Reference Include="Microsoft.AspNetCore" />
11+
<Reference Include="Microsoft.AspNetCore.Components.Server" />
12+
<Reference Include="Microsoft.AspNetCore.HttpsPolicy" />
13+
<Reference Include="Microsoft.AspNetCore.Mvc" />
14+
<Reference Include="Microsoft.Extensions.Hosting" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace BlazorUnitedApp.Data;
5+
6+
public class WeatherForecast
7+
{
8+
public DateTime Date { get; set; }
9+
10+
public int TemperatureC { get; set; }
11+
12+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
13+
14+
public string Summary { get; set; } = default!;
15+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace BlazorUnitedApp.Data;
5+
6+
public class WeatherForecastService
7+
{
8+
private static readonly string[] Summaries = new[]
9+
{
10+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
11+
};
12+
13+
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
14+
{
15+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
16+
{
17+
Date = startDate.AddDays(index),
18+
TemperatureC = Random.Shared.Next(-20, 55),
19+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
20+
}).ToArray());
21+
}
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@page "/counter"
2+
3+
<PageTitle>Counter</PageTitle>
4+
5+
<h1>Counter</h1>
6+
7+
<p id="counter">Current count: @currentCount</p>
8+
9+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
10+
11+
@code {
12+
int currentCount = 0;
13+
14+
void IncrementCount()
15+
{
16+
currentCount++;
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/error"
2+
3+
4+
<h1 class="text-danger">Error.</h1>
5+
<h2 class="text-danger">An error occurred while processing your request.</h2>
6+
7+
<h3>Development Mode</h3>
8+
<p>
9+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
10+
</p>
11+
<p>
12+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
13+
It can result in displaying sensitive information from exceptions to end users.
14+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
15+
and restarting the app.
16+
</p>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@page "/fetchdata"
2+
3+
<PageTitle>Weather forecast</PageTitle>
4+
5+
@using BlazorUnitedApp.Data
6+
@inject WeatherForecastService ForecastService
7+
8+
<h1>Weather forecast</h1>
9+
10+
<p>This component demonstrates fetching data from a service.</p>
11+
12+
@if (forecasts == null)
13+
{
14+
<p><em>Loading...</em></p>
15+
}
16+
else
17+
{
18+
<table class="table">
19+
<thead>
20+
<tr>
21+
<th>Date</th>
22+
<th>Temp. (C)</th>
23+
<th>Temp. (F)</th>
24+
<th>Summary</th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
@foreach (var forecast in forecasts)
29+
{
30+
<tr>
31+
<td>@forecast.Date.ToShortDateString()</td>
32+
<td>@forecast.TemperatureC</td>
33+
<td>@forecast.TemperatureF</td>
34+
<td>@forecast.Summary</td>
35+
</tr>
36+
}
37+
</tbody>
38+
</table>
39+
}
40+
41+
@code {
42+
WeatherForecast[]? forecasts;
43+
44+
protected override async Task OnInitializedAsync()
45+
{
46+
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
47+
}
48+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@page "/"
2+
3+
<PageTitle>Index</PageTitle>
4+
5+
<h1>Hello, world!</h1>
6+
7+
Welcome to your new app.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@layout MainLayout

0 commit comments

Comments
 (0)