//
using System;
using BookShopDataBaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BookShopDataBaseImplement.Migrations
{
[DbContext(typeof(BookShopDatabase))]
partial class BookShopDatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BookShopDataBaseImplement.Models.Author", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("AuthorName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("AuthorPatronymic")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("AuthorSurname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Authors");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Book", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("BookName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Cost")
.HasColumnType("float");
b.Property("GenreId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("GenreId");
b.ToTable("Books");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.BookAuthor", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("AuthorId")
.HasColumnType("int");
b.Property("BookId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("BookId");
b.ToTable("BookAuthors");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Client", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ClientName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ClientPatronymic")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ClientSurname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Genre", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("GenreName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Genres");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("BookId")
.HasColumnType("int");
b.Property("ClientId")
.HasColumnType("int");
b.Property("Count")
.HasColumnType("int");
b.Property("DateCreate")
.HasColumnType("datetime2");
b.Property("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("ClientId");
b.ToTable("Orders");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Book", b =>
{
b.HasOne("BookShopDataBaseImplement.Models.Genre", "Genre")
.WithMany("Books")
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Genre");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.BookAuthor", b =>
{
b.HasOne("BookShopDataBaseImplement.Models.Author", "Author")
.WithMany("BookAuthors")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookShopDataBaseImplement.Models.Book", "Book")
.WithMany("Authors")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Book");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Order", b =>
{
b.HasOne("BookShopDataBaseImplement.Models.Book", "Book")
.WithMany("Orders")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookShopDataBaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Client");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Author", b =>
{
b.Navigation("BookAuthors");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Book", b =>
{
b.Navigation("Authors");
b.Navigation("Orders");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Genre", b =>
{
b.Navigation("Books");
});
#pragma warning restore 612, 618
}
}
}