Skip to content

Commit edd373b

Browse files
authored
Merge pull request #17 from CodeFactoryLLC/BlazorServerDemo
Initial definition of demo architecture to be used with multiple exam…
2 parents 0b3b9b2 + 4558edd commit edd373b

File tree

130 files changed

+4034
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4034
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace Demo.Arch.Abstraction.Contracts
4+
{
5+
public class Class1
6+
{
7+
8+
}
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\Demo.Arch.App.Model\Demo.Arch.App.Model.csproj" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Demo.Arch.Abstraction.Transport.Rest
2+
{
3+
public class Class1
4+
{
5+
6+
}
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="CodeFactory.NDF" Version="1.23111.1" />
11+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\Demo.Arch.Abstraction.Contracts\Demo.Arch.Abstraction.Contracts.csproj" />
16+
<ProjectReference Include="..\Demo.Arch.App.Model\Demo.Arch.App.Model.csproj" />
17+
<ProjectReference Include="..\Demo.Arch.Transport.Rest.Model\Demo.Arch.Transport.Rest.Model.csproj" />
18+
</ItemGroup>
19+
20+
</Project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using CodeFactory.NDF;
2+
using Microsoft.Extensions.Configuration;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace Demo.Arch.Abstraction.Transport.Rest
11+
{
12+
/// <summary>
13+
/// Provides dependency injection management for this library.
14+
/// </summary>
15+
public class LibraryLoader : DependencyInjectionLoader
16+
{
17+
/// <summary>
18+
/// Loads child libraries that are subscribed to by this library.
19+
/// </summary>
20+
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
21+
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
22+
protected override void LoadLibraries(IServiceCollection serviceCollection, IConfiguration configuration)
23+
{
24+
//Add child libraries to load if nessecary.
25+
}
26+
27+
/// <summary>
28+
/// Loads dependency injections that are setup and configured manually.
29+
/// </summary>
30+
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
31+
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
32+
protected override void LoadManualRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
33+
{
34+
//Manual register singlton and other services that cannot be loaded through automation.
35+
}
36+
37+
/// <summary>
38+
/// Loads dependency injections that are setup and configured manually.
39+
/// </summary>
40+
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
41+
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
42+
protected override void LoadRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
43+
{
44+
//Auto generation for transient classes through automation.
45+
}
46+
}
47+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace Demo.Arch.App.Model
4+
{
5+
public class Class1
6+
{
7+
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Demo.Arch.Client.Maui.Model
2+
{
3+
// All the code in this file is included in all platforms.
4+
public class Class1
5+
{
6+
}
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
8+
<UseMaui>true</UseMaui>
9+
<SingleProject>true</SingleProject>
10+
<ImplicitUsings>enable</ImplicitUsings>
11+
12+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
13+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
14+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
15+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
16+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
17+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
18+
</PropertyGroup>
19+
20+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Demo.Arch.Client.Maui.Model
2+
{
3+
// All the code in this file is only included on Android.
4+
public class PlatformClass1
5+
{
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Demo.Arch.Client.Maui.Model
2+
{
3+
// All the code in this file is only included on Mac Catalyst.
4+
public class PlatformClass1
5+
{
6+
}
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace Demo.Arch.Client.Maui.Model
4+
{
5+
// All the code in this file is only included on Tizen.
6+
public class PlatformClass1
7+
{
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Demo.Arch.Client.Maui.Model
2+
{
3+
// All the code in this file is only included on Windows.
4+
public class PlatformClass1
5+
{
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Demo.Arch.Client.Maui.Model
2+
{
3+
// All the code in this file is only included on iOS.
4+
public class PlatformClass1
5+
{
6+
}
7+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:Demo.Arch.Client.Maui"
5+
x:Class="Demo.Arch.Client.Maui.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
9+
<Color x:Key="PageBackgroundColor">#512bdf</Color>
10+
<Color x:Key="PrimaryTextColor">White</Color>
11+
12+
<Style TargetType="Label">
13+
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
14+
<Setter Property="FontFamily" Value="OpenSansRegular" />
15+
</Style>
16+
17+
<Style TargetType="Button">
18+
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
19+
<Setter Property="FontFamily" Value="OpenSansRegular" />
20+
<Setter Property="BackgroundColor" Value="#2b0b98" />
21+
<Setter Property="Padding" Value="14,10" />
22+
</Style>
23+
24+
</ResourceDictionary>
25+
</Application.Resources>
26+
</Application>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Demo.Arch.Client.Maui
2+
{
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new MainPage();
10+
}
11+
}
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Demo.Arch.Client.Maui.Data
2+
{
3+
public class WeatherForecast
4+
{
5+
public DateTime Date { get; set; }
6+
7+
public int TemperatureC { get; set; }
8+
9+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
10+
11+
public string Summary { get; set; }
12+
}
13+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Demo.Arch.Client.Maui.Data
2+
{
3+
public class WeatherForecastService
4+
{
5+
private static readonly string[] Summaries = new[]
6+
{
7+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
8+
};
9+
10+
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
11+
{
12+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
13+
{
14+
Date = startDate.AddDays(index),
15+
TemperatureC = Random.Shared.Next(-20, 55),
16+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
17+
}).ToArray());
18+
}
19+
}
20+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>Demo.Arch.Client.Maui</RootNamespace>
10+
<UseMaui>true</UseMaui>
11+
<SingleProject>true</SingleProject>
12+
<ImplicitUsings>enable</ImplicitUsings>
13+
<EnableDefaultCssItems>false</EnableDefaultCssItems>
14+
15+
<!-- Display name -->
16+
<ApplicationTitle>Demo.Arch.Client.Maui</ApplicationTitle>
17+
18+
<!-- App Identifier -->
19+
<ApplicationId>com.companyname.demo.arch.client.maui</ApplicationId>
20+
<ApplicationIdGuid>D7C6EEDD-4A6B-4398-963C-8F8B11F40DB9</ApplicationIdGuid>
21+
22+
<!-- Versions -->
23+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
24+
<ApplicationVersion>1</ApplicationVersion>
25+
26+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
28+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
29+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
30+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
31+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
32+
</PropertyGroup>
33+
34+
<ItemGroup>
35+
<!-- App Icon -->
36+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
37+
38+
<!-- Splash Screen -->
39+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
40+
41+
<!-- Images -->
42+
<MauiImage Include="Resources\Images\*" />
43+
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
44+
45+
<!-- Custom Fonts -->
46+
<MauiFont Include="Resources\Fonts\*" />
47+
48+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
49+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
50+
</ItemGroup>
51+
52+
<ItemGroup>
53+
<PackageReference Include="CodeFactory.NDF" Version="1.23111.1" />
54+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
55+
</ItemGroup>
56+
57+
<ItemGroup>
58+
<ProjectReference Include="..\Demo.Arch.Abstraction.Contracts\Demo.Arch.Abstraction.Contracts.csproj" />
59+
<ProjectReference Include="..\Demo.Arch.Abstraction.Transport.Rest\Demo.Arch.Abstraction.Transport.Rest.csproj" />
60+
<ProjectReference Include="..\Demo.Arch.App.Model\Demo.Arch.App.Model.csproj" />
61+
<ProjectReference Include="..\Demo.Arch.Client.Maui.Model\Demo.Arch.Client.Maui.Model.csproj" />
62+
</ItemGroup>
63+
64+
</Project>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using CodeFactory.NDF;
2+
using Microsoft.Extensions.Configuration;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace Demo.Arch.Client.Maui
10+
{
11+
/// <summary>
12+
/// Provides dependency injection management for this library.
13+
/// </summary>
14+
public class LibraryLoader : DependencyInjectionLoader
15+
{
16+
/// <summary>
17+
/// Loads child libraries that are subscribed to by this library.
18+
/// </summary>
19+
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
20+
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
21+
protected override void LoadLibraries(IServiceCollection serviceCollection, IConfiguration configuration)
22+
{
23+
var abstractLoader = new Abstraction.Transport.Rest.LibraryLoader();
24+
25+
abstractLoader.Load(serviceCollection, configuration);
26+
}
27+
28+
/// <summary>
29+
/// Loads dependency injections that are setup and configured manually.
30+
/// </summary>
31+
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
32+
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
33+
protected override void LoadManualRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
34+
{
35+
//Manual register singlton and other services that cannot be loaded through automation.
36+
}
37+
38+
/// <summary>
39+
/// Loads dependency injections that are setup and configured manually.
40+
/// </summary>
41+
/// <param name="serviceCollection">The dependency injection provider to register services with.</param>
42+
/// <param name="configuration">The source configuration to provide for dependency injection.</param>
43+
protected override void LoadRegistration(IServiceCollection serviceCollection, IConfiguration configuration)
44+
{
45+
//Auto generation for transient classes through automation.
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)