Add project files.
This commit is contained in:
parent
e0bb90a24a
commit
c06f4645a9
25
Weifer.Database.EF.sln
Normal file
25
Weifer.Database.EF.sln
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.9.34526.213
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weifer.Database.EF", "Weifer.Database.EF\Weifer.Database.EF.csproj", "{20B939C6-8D62-4DCA-B47D-AE17FE96A0CA}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{20B939C6-8D62-4DCA-B47D-AE17FE96A0CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{20B939C6-8D62-4DCA-B47D-AE17FE96A0CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{20B939C6-8D62-4DCA-B47D-AE17FE96A0CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{20B939C6-8D62-4DCA-B47D-AE17FE96A0CA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {493039A3-BE7C-4200-8165-C1B32A1461F9}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
50
Weifer.Database.EF/DatabaseContext.cs
Normal file
50
Weifer.Database.EF/DatabaseContext.cs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using Weifer.Database.EF.Entitys;
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF
|
||||||
|
{
|
||||||
|
public class DatabaseContext : DbContext
|
||||||
|
{
|
||||||
|
public DatabaseContext() { }
|
||||||
|
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
||||||
|
public virtual DbSet<Customer> Customers { get; set; }
|
||||||
|
public virtual DbSet<ShoppingList> ShoppingLists { get; set; }
|
||||||
|
public virtual DbSet<ShoppingItem> ShoppingItems { get; set; }
|
||||||
|
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
if (!optionsBuilder.IsConfigured)
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var connectionString = configuration.GetConnectionString("ShoppingApp");
|
||||||
|
optionsBuilder.UseSqlServer(connectionString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
|
||||||
|
modelBuilder.Entity<Customer>()
|
||||||
|
.HasMany(c => c.ShoppingLists)
|
||||||
|
.WithOne()
|
||||||
|
.HasForeignKey(sl => sl.CustomerId)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
|
||||||
|
modelBuilder.Entity<ShoppingList>()
|
||||||
|
.HasMany(sl => sl.ShoppingItems)
|
||||||
|
.WithOne()
|
||||||
|
.HasForeignKey(si => si.ShoppingListId)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
Weifer.Database.EF/Entitys/Customer.cs
Normal file
19
Weifer.Database.EF/Entitys/Customer.cs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF.Entitys
|
||||||
|
{
|
||||||
|
public class Customer
|
||||||
|
{
|
||||||
|
public Guid CustomerId { get; set; }
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
public string LastName { get; set; }
|
||||||
|
public string Email { get; set; }
|
||||||
|
public string PasswordHash { get; set; }
|
||||||
|
public DateTime CreatedOn { get; set; }
|
||||||
|
public ICollection<ShoppingList> ShoppingLists { get; set; }
|
||||||
|
}
|
||||||
|
}
|
17
Weifer.Database.EF/Entitys/ShoppingItem.cs
Normal file
17
Weifer.Database.EF/Entitys/ShoppingItem.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF.Entitys
|
||||||
|
{
|
||||||
|
public class ShoppingItem
|
||||||
|
{
|
||||||
|
public Guid ShoppingItemId { get; set; }
|
||||||
|
public Guid ShoppingListId { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public int Number { get; set; } = 0;
|
||||||
|
public bool Purchased { get; set; } = false;
|
||||||
|
}
|
||||||
|
}
|
16
Weifer.Database.EF/Entitys/ShoppingList.cs
Normal file
16
Weifer.Database.EF/Entitys/ShoppingList.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF.Entitys
|
||||||
|
{
|
||||||
|
public class ShoppingList
|
||||||
|
{
|
||||||
|
public Guid ShoppingListId { get; set; }
|
||||||
|
public Guid CustomerId { get; set; }
|
||||||
|
public string ShoppingListName { get; set; }
|
||||||
|
public ICollection<ShoppingItem> ShoppingItems { get; set; }
|
||||||
|
}
|
||||||
|
}
|
134
Weifer.Database.EF/Migrations/20240223223336_init.Designer.cs
generated
Normal file
134
Weifer.Database.EF/Migrations/20240223223336_init.Designer.cs
generated
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Weifer.Database.EF;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(DatabaseContext))]
|
||||||
|
[Migration("20240223223336_init")]
|
||||||
|
partial class init
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.2")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.Customer", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("CustomerId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedOn")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("CustomerId");
|
||||||
|
|
||||||
|
b.ToTable("Customers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("ShoppingItemId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Number")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Purchased")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("ShoppingListId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("ShoppingItemId");
|
||||||
|
|
||||||
|
b.HasIndex("ShoppingListId");
|
||||||
|
|
||||||
|
b.ToTable("ShoppingItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingList", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("ShoppingListId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("CustomerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ShoppingListName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("ShoppingListId");
|
||||||
|
|
||||||
|
b.HasIndex("CustomerId");
|
||||||
|
|
||||||
|
b.ToTable("ShoppingLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Weifer.Database.EF.Entitys.ShoppingList", null)
|
||||||
|
.WithMany("ShoppingItems")
|
||||||
|
.HasForeignKey("ShoppingListId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingList", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Weifer.Database.EF.Entitys.Customer", null)
|
||||||
|
.WithMany("ShoppingLists")
|
||||||
|
.HasForeignKey("CustomerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.Customer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ShoppingLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingList", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ShoppingItems");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
94
Weifer.Database.EF/Migrations/20240223223336_init.cs
Normal file
94
Weifer.Database.EF/Migrations/20240223223336_init.cs
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class init : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Customers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
CreatedOn = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Customers", x => x.CustomerId);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShoppingLists",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ShoppingListId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
ShoppingListName = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShoppingLists", x => x.ShoppingListId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShoppingLists_Customers_CustomerId",
|
||||||
|
column: x => x.CustomerId,
|
||||||
|
principalTable: "Customers",
|
||||||
|
principalColumn: "CustomerId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShoppingItems",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ShoppingItemId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
ShoppingListId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Number = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Purchased = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShoppingItems", x => x.ShoppingItemId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShoppingItems_ShoppingLists_ShoppingListId",
|
||||||
|
column: x => x.ShoppingListId,
|
||||||
|
principalTable: "ShoppingLists",
|
||||||
|
principalColumn: "ShoppingListId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShoppingItems_ShoppingListId",
|
||||||
|
table: "ShoppingItems",
|
||||||
|
column: "ShoppingListId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShoppingLists_CustomerId",
|
||||||
|
table: "ShoppingLists",
|
||||||
|
column: "CustomerId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShoppingItems");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShoppingLists");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Customers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
131
Weifer.Database.EF/Migrations/DatabaseContextModelSnapshot.cs
Normal file
131
Weifer.Database.EF/Migrations/DatabaseContextModelSnapshot.cs
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Weifer.Database.EF;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Weifer.Database.EF.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(DatabaseContext))]
|
||||||
|
partial class DatabaseContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.2")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.Customer", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("CustomerId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedOn")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("CustomerId");
|
||||||
|
|
||||||
|
b.ToTable("Customers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("ShoppingItemId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Number")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Purchased")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("ShoppingListId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("ShoppingItemId");
|
||||||
|
|
||||||
|
b.HasIndex("ShoppingListId");
|
||||||
|
|
||||||
|
b.ToTable("ShoppingItems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingList", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("ShoppingListId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("CustomerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ShoppingListName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("ShoppingListId");
|
||||||
|
|
||||||
|
b.HasIndex("CustomerId");
|
||||||
|
|
||||||
|
b.ToTable("ShoppingLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Weifer.Database.EF.Entitys.ShoppingList", null)
|
||||||
|
.WithMany("ShoppingItems")
|
||||||
|
.HasForeignKey("ShoppingListId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingList", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Weifer.Database.EF.Entitys.Customer", null)
|
||||||
|
.WithMany("ShoppingLists")
|
||||||
|
.HasForeignKey("CustomerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.Customer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ShoppingLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Weifer.Database.EF.Entitys.ShoppingList", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ShoppingItems");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Weifer.Database.EF/Weifer.Database.EF.csproj
Normal file
25
Weifer.Database.EF/Weifer.Database.EF.csproj
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
5
Weifer.Database.EF/appsettings.json
Normal file
5
Weifer.Database.EF/appsettings.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"ShoppingApp": "Server=192.168.0.187,1433;Database=ShoppingApp;User Id=sa;Password=Su746MoWyM8CtqgiCc3oWzsb;Trusted_Connection=False;TrustServerCertificate=True"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user