﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using kisvuz.Models;

namespace kisvuz.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    [Migration("20170802180639_init3")]
    partial class init3
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
            modelBuilder
                .HasAnnotation("ProductVersion", "1.1.2");

            modelBuilder.Entity("kisvuz.Models.Article", b =>
                {
                    b.Property<int>("ArticleID")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("Caption");

                    b.Property<long>("PortfolioID");

                    b.Property<DateTime>("PublicationDate");

                    b.HasKey("ArticleID");

                    b.HasIndex("PortfolioID");

                    b.ToTable("Articles");
                });

            modelBuilder.Entity("kisvuz.Models.Human", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("FIO");

                    b.Property<string>("IdentityId");

                    b.HasKey("Id");

                    b.ToTable("HumanList");
                });

            modelBuilder.Entity("kisvuz.Models.Portfolio", b =>
                {
                    b.Property<long>("PortfolioID")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("UserFIO");

                    b.Property<string>("UserInfo");

                    b.Property<string>("UserPhoto");

                    b.HasKey("PortfolioID");

                    b.ToTable("Portfolios");
                });

            modelBuilder.Entity("kisvuz.Models.Science.CertificateOfRegistrationSoftware", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<long?>("HumanId");

                    b.Property<string>("Name");

                    b.Property<string>("Number");

                    b.Property<string>("Rightholder");

                    b.HasKey("Id");

                    b.HasIndex("HumanId");

                    b.ToTable("CertificatesOfRegistrationSoftware");
                });

            modelBuilder.Entity("kisvuz.Models.Science.CertificateOfRegistrationSoftwareAuthor", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<long>("CertificateOfRegistrationSoftwareID");

                    b.Property<long>("HumanId");

                    b.HasKey("Id");

                    b.HasIndex("CertificateOfRegistrationSoftwareID");

                    b.ToTable("CertificateOfRegistrationSoftwareAuthors");
                });

            modelBuilder.Entity("kisvuz.Models.Article", b =>
                {
                    b.HasOne("kisvuz.Models.Portfolio", "portfolio")
                        .WithMany("Articles")
                        .HasForeignKey("PortfolioID")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("kisvuz.Models.Science.CertificateOfRegistrationSoftware", b =>
                {
                    b.HasOne("kisvuz.Models.Human")
                        .WithMany("CertificatesOfRegistrationSoftware")
                        .HasForeignKey("HumanId");
                });

            modelBuilder.Entity("kisvuz.Models.Science.CertificateOfRegistrationSoftwareAuthor", b =>
                {
                    b.HasOne("kisvuz.Models.Science.CertificateOfRegistrationSoftware")
                        .WithMany("Authors")
                        .HasForeignKey("CertificateOfRegistrationSoftwareID")
                        .OnDelete(DeleteBehavior.Cascade);
                });
        }
    }
}
