// <auto-generated />
using System;
using BLL.DAL;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BLL.Migrations
{
[DbContext(typeof(Db))]
[Migration("20240910150438_v1")]
partial class v1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BLL.DAL.Resource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("Date")
.HasColumnType("datetime2");
b.Property<decimal>("Score")
.HasColumnType("decimal(18,2)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Resources");
});
modelBuilder.Entity("BLL.DAL.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("BLL.DAL.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.Property<int>("RoleId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("Users");
});
modelBuilder.Entity("BLL.DAL.UserResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ResourceId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("UserId");
b.ToTable("UserResources");
});
modelBuilder.Entity("BLL.DAL.User", b =>
{
b.HasOne("BLL.DAL.Role", "Role")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
});
modelBuilder.Entity("BLL.DAL.UserResource", b =>
{
b.HasOne("BLL.DAL.Resource", "Resource")
.WithMany("UserResources")
.HasForeignKey("ResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BLL.DAL.User", "User")
.WithMany("UserResources")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Resource");
b.Navigation("User");
});
modelBuilder.Entity("BLL.DAL.Resource", b =>
{
b.Navigation("UserResources");
});
modelBuilder.Entity("BLL.DAL.Role", b =>
{
b.Navigation("Users");
});
modelBuilder.Entity("BLL.DAL.User", b =>
{
b.Navigation("UserResources");
});
#pragma warning restore 612, 618
}
}
}