Skip to content

Commit 83dbca2

Browse files
authored
Merge pull request #21 from michielpost/feature/hue-entertainment-pro
New version: Hue Entertainment Pro
2 parents d83ca3b + af7eaf8 commit 83dbca2

File tree

111 files changed

+7226
-101
lines changed

Some content is hidden

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

111 files changed

+7226
-101
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v3
1212
- name: Setup .NET Core
13-
uses: actions/setup-dotnet@v3
13+
uses: actions/setup-dotnet@v4
1414
with:
1515
dotnet-version: 9.0.x
1616
- name: Install maui workloads
1717
run: dotnet workload install maui-android
1818
- name: Build with dotnet
19-
run: dotnet build --configuration Debug
19+
run: dotnet build HueEntertainmentPro.sln --configuration Debug
2020
- name: Publish Website
21-
run: dotnet publish HueLightDJ.BlazorWeb/Server -o publish/HueLightDJ.BlazorWeb.Server -c Debug
22-
- name: Publish Website (OLD)
23-
run: dotnet publish HueLightDJ.Web -o publish/HueLightDJ.Web -c Debug
21+
run: dotnet publish HueEntertainmentPro/Server -o publish/HueEntertainmentPro.Server -c Debug

.github/workflows/master_huelightdj.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
22
# More GitHub Actions for Azure: https://github.com/Azure/actions
33

4-
name: Build and deploy ASP.Net Core app to Azure Web App - huelightdj
4+
name: Build and deploy ASP.Net Core app to Azure Web App - HueEntertainmentPro
55

66
on:
77
push:
@@ -17,13 +17,11 @@ jobs:
1717
- uses: actions/checkout@v3
1818

1919
- name: Set up .NET Core
20-
uses: actions/setup-dotnet@v3
20+
uses: actions/setup-dotnet@v4
2121
with:
2222
dotnet-version: '9.x'
23-
- name: Install maui workloads
24-
run: dotnet workload install maui-android
2523
- name: dotnet publish
26-
run: dotnet publish HueLightDJ.BlazorWeb/Server -c Release -o ${{env.DOTNET_ROOT}}/myapp
24+
run: dotnet publish HueEntertainmentPro/Server -c Release -o ${{env.DOTNET_ROOT}}/myapp
2725

2826
- name: Upload artifact for deployment job
2927
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,7 @@ paket-files/
258258

259259
# Python Tools for Visual Studio (PTVS)
260260
__pycache__/
261-
*.pyc
261+
*.pyc
262+
/HueEntertainmentPro/Server/App_Data/*.db-shm
263+
/HueEntertainmentPro/Server/App_Data/*.db-wal
264+
/HueEntertainmentPro/Server/App_Data/HueEntertainmentPro.db

Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.9" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.9" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using HueEntertainmentPro.Database.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
4+
5+
namespace HueEntertainmentPro.Database
6+
{
7+
public class HueEntertainmentProDbContext : DbContext
8+
{
9+
public DbSet<Bridge> Bridges { get; set; } = default!;
10+
public DbSet<ProArea> ProAreas { get; set; } = default!;
11+
public DbSet<ProAreaBridgeGroup> ProAreaGroups { get; set; } = default!;
12+
13+
public HueEntertainmentProDbContext(DbContextOptions<HueEntertainmentProDbContext> options)
14+
: base(options)
15+
{
16+
17+
}
18+
19+
protected override void OnModelCreating(ModelBuilder builder)
20+
{
21+
if (Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite")
22+
{
23+
//Fix GUID casing for SQLite
24+
foreach (var entityType in builder.Model.GetEntityTypes())
25+
{
26+
var clrType = entityType.ClrType;
27+
28+
foreach (var propertyInfo in clrType.GetProperties())
29+
{
30+
// Handle non-nullable Guid
31+
if (propertyInfo.PropertyType == typeof(Guid))
32+
{
33+
var entityBuilder = builder.Entity(clrType);
34+
35+
entityBuilder
36+
.Property(propertyInfo.Name)
37+
.HasConversion(
38+
new ValueConverter<Guid, string>(
39+
v => v.ToString(),
40+
v => Guid.Parse(v)))
41+
.UseCollation("NOCASE");
42+
}
43+
44+
// Handle nullable Guid?
45+
else if (propertyInfo.PropertyType == typeof(Guid?))
46+
{
47+
var entityBuilder = builder.Entity(clrType);
48+
49+
entityBuilder
50+
.Property(propertyInfo.Name)
51+
.HasConversion(
52+
new ValueConverter<Guid?, string>(
53+
v => v.HasValue ? v.Value.ToString() : null,
54+
v => v != null ? Guid.Parse(v) : (Guid?)null))
55+
.UseCollation("NOCASE");
56+
}
57+
}
58+
}
59+
60+
61+
// SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
62+
// here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
63+
// To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
64+
// use the DateTimeOffsetToBinaryConverter
65+
// Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
66+
// This only supports millisecond precision, but should be sufficient for most use cases.
67+
foreach (var entityType in builder.Model.GetEntityTypes())
68+
{
69+
var properties = entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(DateTimeOffset)
70+
|| p.PropertyType == typeof(DateTimeOffset?));
71+
foreach (var property in properties)
72+
{
73+
builder
74+
.Entity(entityType.Name)
75+
.Property(property.Name)
76+
.HasConversion(new DateTimeOffsetToBinaryConverter());
77+
}
78+
}
79+
}
80+
81+
base.OnModelCreating(builder);
82+
}
83+
84+
}
85+
}

HueEntertainmentPro.Database/Migrations/20250909113020_Initial.Designer.cs

Lines changed: 139 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)