-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adam Dębowski
committed
Dec 9, 2024
1 parent
ee40721
commit 1dc242d
Showing
53 changed files
with
2,989 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace hiPower.Common.Type; | ||
|
||
public enum MonitorState | ||
{ | ||
None, | ||
Ready, | ||
Stop, | ||
Suspend | ||
} |
2 changes: 1 addition & 1 deletion
2
src/hiPower.Common.Type/ServerState.cs → src/hiPower.Common.Type/ServiceState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace hiPower.Common.Type; | ||
|
||
public enum ServerState | ||
public enum ServiceState | ||
{ | ||
Unknown = 0, | ||
On = 10, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/hiPower.Database/Configuration/MonitorServiceEntityConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using hiPower.Common.Type; | ||
using hiPower.Entity; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace hiPower.Database.Configuration; | ||
|
||
internal class MonitorServiceEntityConfiguration : IEntityTypeConfiguration<MonitorService> | ||
{ | ||
public void Configure (EntityTypeBuilder<MonitorService> builder) | ||
{ | ||
builder.ToTable ($"{Prefix.Table}{nameof(MonitorService)}"); | ||
|
||
builder.HasKey ( t => t.ServiceId ); | ||
|
||
builder.HasIndex (i => new { i.ServiceId, i.MonitorState }); | ||
|
||
builder.Property (p => p.ServiceId) | ||
.HasMaxLength (36) | ||
.HasConversion (value => value.ToUpperInvariant (), | ||
value => value) | ||
.IsRequired(); | ||
|
||
builder.Property(p => p.MonitorState) | ||
.HasConversion(value => value.ToString().ToLowerInvariant(), | ||
value => Enum.Parse<MonitorState>(value, true)) | ||
.HasMaxLength(10) | ||
.IsRequired(); | ||
|
||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/hiPower.Database/Configuration/MonitorVariablesEntityConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using hiPower.Entity; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace hiPower.Database.Configuration; | ||
|
||
internal class MonitorVariablesEntityConfiguration : IEntityTypeConfiguration<MonitorVariables> | ||
{ | ||
public void Configure (EntityTypeBuilder<MonitorVariables> builder) | ||
{ | ||
builder.ToTable ($"{Prefix.Table}{nameof (MonitorVariables)}"); | ||
|
||
builder.HasKey (k => k.ServiceId); | ||
|
||
builder.Property (p => p.ServiceId) | ||
.HasMaxLength (36) | ||
.HasConversion (value => value.ToUpperInvariant (), | ||
value => value) | ||
.IsRequired (); | ||
|
||
builder.Property (p => p.Variable) | ||
.HasMaxLength (30) | ||
.IsRequired (); | ||
} | ||
} |
Oops, something went wrong.