Skip to content

Commit 50de649

Browse files
first commit
0 parents  commit 50de649

19 files changed

+1094
-0
lines changed

.gitignore

+484
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace LaneSenseGuard.Core.Application;
2+
3+
public class ApplicationAssemblyReference : BuildingBlock.Core.Application.ApplicationAssemblyReference
4+
{
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\LaneSenseGuard.Core.Domain\LaneSenseGuard.Core.Domain.csproj" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Phuc1403.BuildingBlock.Core.Application" Version="2024.5.31.1909" />
15+
</ItemGroup>
16+
17+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace LaneSenseGuard.Core.Domain;
2+
3+
public class DomainAssemblyReference : BuildingBlock.Core.Domain.DomainAssemblyReference
4+
{
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Phuc1403.BuildingBlock.Core.Domain" Version="2024.5.31.1909" />
11+
</ItemGroup>
12+
13+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using BuildingBlock.Core.Domain;
2+
3+
namespace LaneSenseGuard.Core.Domain.RaspberryAggregate.Entities;
4+
5+
public class Connection : Entity
6+
{
7+
public Raspberry Raspberry { get; set; } = null!;
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using BuildingBlock.Core.Domain;
2+
3+
namespace LaneSenseGuard.Core.Domain.RaspberryAggregate.Entities;
4+
5+
public class Raspberry : AggregateRoot
6+
{
7+
public List<Connection> Connections { get; set; } = [];
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using BuildingBlock.Core.Application;
2+
using BuildingBlock.Infrastructure.EntityFrameworkCore;
3+
using LaneSenseGuard.Core.Domain.RaspberryAggregate.Entities;
4+
using MediatR;
5+
using Microsoft.EntityFrameworkCore;
6+
7+
namespace LaneSenseGuard.Infrastructure.EntityFrameworkCore;
8+
9+
public class DbContext : BaseDbContext
10+
{
11+
public DbContext(DbContextOptions options, ICurrentUser currentUser, IMediator mediator) : base(options, currentUser, mediator)
12+
{
13+
}
14+
public DbSet<Raspberry> Raspberries { get; set; } = null!;
15+
16+
protected override void OnModelCreating(ModelBuilder builder)
17+
{
18+
base.OnModelCreating(builder);
19+
20+
builder.ApplyConfigurationsFromAssembly(typeof(DbContext).Assembly);
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\..\Core\LaneSenseGuard.Core.Application\LaneSenseGuard.Core.Application.csproj" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Phuc1403.BuildingBlock.Infrastructure.EntityFrameworkCore" Version="2024.5.31.1909" />
15+
</ItemGroup>
16+
17+
</Project>

Infrastructure/LaneSenseGuard.Infrastructure.EntityFrameworkCore/Migrations/20240615175251_Initial.Designer.cs

+111
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
#nullable disable
5+
6+
namespace LaneSenseGuard.Infrastructure.EntityFrameworkCore.Migrations
7+
{
8+
/// <inheritdoc />
9+
public partial class Initial : Migration
10+
{
11+
/// <inheritdoc />
12+
protected override void Up(MigrationBuilder migrationBuilder)
13+
{
14+
migrationBuilder.CreateTable(
15+
name: "Raspberries",
16+
columns: table => new
17+
{
18+
Id = table.Column<Guid>(type: "uuid", nullable: false),
19+
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
20+
DeletedBy = table.Column<string>(type: "text", nullable: true),
21+
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
22+
CreatedBy = table.Column<string>(type: "text", nullable: false),
23+
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
24+
UpdatedBy = table.Column<string>(type: "text", nullable: true)
25+
},
26+
constraints: table =>
27+
{
28+
table.PrimaryKey("PK_Raspberries", x => x.Id);
29+
});
30+
31+
migrationBuilder.CreateTable(
32+
name: "Connection",
33+
columns: table => new
34+
{
35+
Id = table.Column<Guid>(type: "uuid", nullable: false),
36+
RaspberryId = table.Column<Guid>(type: "uuid", nullable: false),
37+
DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
38+
DeletedBy = table.Column<string>(type: "text", nullable: true),
39+
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
40+
CreatedBy = table.Column<string>(type: "text", nullable: false),
41+
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
42+
UpdatedBy = table.Column<string>(type: "text", nullable: true)
43+
},
44+
constraints: table =>
45+
{
46+
table.PrimaryKey("PK_Connection", x => x.Id);
47+
table.ForeignKey(
48+
name: "FK_Connection_Raspberries_RaspberryId",
49+
column: x => x.RaspberryId,
50+
principalTable: "Raspberries",
51+
principalColumn: "Id",
52+
onDelete: ReferentialAction.Cascade);
53+
});
54+
55+
migrationBuilder.CreateIndex(
56+
name: "IX_Connection_RaspberryId",
57+
table: "Connection",
58+
column: "RaspberryId");
59+
}
60+
61+
/// <inheritdoc />
62+
protected override void Down(MigrationBuilder migrationBuilder)
63+
{
64+
migrationBuilder.DropTable(
65+
name: "Connection");
66+
67+
migrationBuilder.DropTable(
68+
name: "Raspberries");
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)