-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
44 changed files
with
1,985 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Wissance.MossbauerLab.Watcher/Wissance.MossbauerLab.Watcher.Data/Entities/EventEntity.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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Wissance.WebApiToolkit.Data.Entity; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data.Entities | ||
{ | ||
public enum EventType | ||
{ | ||
NetworkLoss = 1, | ||
PowerLoss = 2, | ||
Maintenance = 3 | ||
} | ||
|
||
public class EventEntity : IModelIdentifiable<int> | ||
{ | ||
public EventEntity() | ||
{ | ||
} | ||
|
||
public EventEntity(EventType eventType, DateTime start, DateTime? finish) | ||
{ | ||
Type = eventType; | ||
Start = start; | ||
Finish = finish; | ||
} | ||
|
||
public int Id { get; } | ||
public EventType Type { get; set; } | ||
public DateTime Start { get; set; } | ||
public DateTime? Finish { get; set; } | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Wissance.MossbauerLab.Watcher/Wissance.MossbauerLab.Watcher.Data/Entities/SpectrumEntity.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,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Wissance.WebApiToolkit.Data.Entity; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data.Entities | ||
{ | ||
public class SpectrumEntity : IModelIdentifiable<int> | ||
{ | ||
public SpectrumEntity() | ||
{ | ||
} | ||
|
||
public SpectrumEntity(string name, string description, string location, DateTime measureStartDate, DateTime? first, DateTime? last) | ||
{ | ||
Name = name; | ||
Description = description; | ||
Location = location; | ||
measureStartDate = MeasureStartDate; | ||
First = first; | ||
Last = last; | ||
} | ||
|
||
public int Id { get; } | ||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public string Location { get; set; } | ||
public DateTime MeasureStartDate { get; set; } | ||
public DateTime? First { get; set; } | ||
public DateTime? Last { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Wissance.MossbauerLab.Watcher/Wissance.MossbauerLab.Watcher.Data/IModelContext.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,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.EntityFrameworkCore; | ||
using Wissance.MossbauerLab.Watcher.Data.Entities; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data | ||
{ | ||
public interface IModelContext | ||
{ | ||
int SaveChanges(); | ||
Task<int> SaveChangesAsync(); | ||
DbSet<SpectrumEntity> Spectra { get; } | ||
DbSet<EventEntity> Events { get; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Wissance.MossbauerLab.Watcher/Wissance.MossbauerLab.Watcher.Data/Mapping/EventMapping.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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Wissance.MossbauerLab.Watcher.Data.Entities; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data.Mapping | ||
{ | ||
internal static class EventMapping | ||
{ | ||
public static void Map(this EntityTypeBuilder<EventEntity> builder) | ||
{ | ||
builder.ToTable("Wissance.MossbauerLab.Event"); | ||
builder.HasKey(p => p.Id); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Wissance.MossbauerLab.Watcher/Wissance.MossbauerLab.Watcher.Data/Mapping/SpectrumMapping.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,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Wissance.MossbauerLab.Watcher.Data.Entities; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data.Mapping | ||
{ | ||
internal static class SpectrumMapping | ||
{ | ||
public static void Map(this EntityTypeBuilder<SpectrumEntity> builder) | ||
{ | ||
builder.ToTable("Wissance.MossbauerLab.Spectrum"); | ||
builder.HasKey(p => p.Id); | ||
builder.Property(p => p.Name).IsRequired(); | ||
builder.HasIndex(p => p.Name); | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...sance.MossbauerLab.Watcher.Data/Migrations/20220801075508_Migration_1_Initial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...tcher/Wissance.MossbauerLab.Watcher.Data/Migrations/20220801075508_Migration_1_Initial.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,39 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data.Migrations | ||
{ | ||
public partial class Migration_1_Initial : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Wissance.MossbauerLab.Spectrum", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(type: "INTEGER", nullable: false) | ||
.Annotation("Sqlite:Autoincrement", true), | ||
Name = table.Column<string>(type: "TEXT", nullable: false), | ||
Description = table.Column<string>(type: "TEXT", nullable: true), | ||
Location = table.Column<string>(type: "TEXT", nullable: true), | ||
First = table.Column<DateTime>(type: "TEXT", nullable: true), | ||
Last = table.Column<DateTime>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Wissance.MossbauerLab.Spectrum", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Wissance.MossbauerLab.Spectrum_Name", | ||
table: "Wissance.MossbauerLab.Spectrum", | ||
column: "Name"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Wissance.MossbauerLab.Spectrum"); | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
....MossbauerLab.Watcher.Data/Migrations/20220804190421_Migration_2_Events_Added.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
.../Wissance.MossbauerLab.Watcher.Data/Migrations/20220804190421_Migration_2_Events_Added.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,32 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
namespace Wissance.MossbauerLab.Watcher.Data.Migrations | ||
{ | ||
public partial class Migration_2_Events_Added : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Wissance.MossbauerLab.Event", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(type: "INTEGER", nullable: false) | ||
.Annotation("Sqlite:Autoincrement", true), | ||
Type = table.Column<int>(type: "INTEGER", nullable: false), | ||
Start = table.Column<DateTime>(type: "TEXT", nullable: false), | ||
Finish = table.Column<DateTime>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Wissance.MossbauerLab.Event", x => x.Id); | ||
}); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Wissance.MossbauerLab.Event"); | ||
} | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...Lab.Watcher.Data/Migrations/20220818112338_Migration_3_Added_MeasureStartDate.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.