123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace ApplicationAvalonia.Models;
- public partial class _41pAgeevNContext : DbContext
- {
- public _41pAgeevNContext()
- {
- }
- public _41pAgeevNContext(DbContextOptions<_41pAgeevNContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Director> Directors { get; set; }
- public virtual DbSet<DirectorsAndFilm> DirectorsAndFilms { get; set; }
- public virtual DbSet<Film> Films { get; set; }
- public virtual DbSet<FilmAndGenre> FilmAndGenres { get; set; }
- public virtual DbSet<Genre> Genres { get; set; }
- public virtual DbSet<LoginTable> LoginTables { get; set; }
- public virtual DbSet<Role> Roles { get; set; }
- public virtual DbSet<UserTable> UserTables { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
- => optionsBuilder.UseNpgsql("Host=ngknn.ru;Port=5442;Username=41P;Password=12357;Database=41P_AgeevN");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Director>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("directors_pk");
- entity.ToTable("directors");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Name)
- .HasColumnType("character varying")
- .HasColumnName("name");
- entity.Property(e => e.Surname)
- .HasColumnType("character varying")
- .HasColumnName("surname");
- });
- modelBuilder.Entity<DirectorsAndFilm>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("directors_and_films_pk");
- entity.ToTable("directors_and_films");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.IdDirector)
- .ValueGeneratedOnAdd()
- .HasColumnName("id_director");
- entity.Property(e => e.IdFilm)
- .ValueGeneratedOnAdd()
- .HasColumnName("id_film");
- entity.HasOne(d => d.IdDirectorNavigation).WithMany(p => p.DirectorsAndFilms)
- .HasForeignKey(d => d.IdDirector)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("directors_and_films_directors_fk");
- entity.HasOne(d => d.IdFilmNavigation).WithMany(p => p.DirectorsAndFilms)
- .HasForeignKey(d => d.IdFilm)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("directors_and_films_films_fk");
- });
- modelBuilder.Entity<Film>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("films_pkey");
- entity.ToTable("films");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Description).HasColumnName("description");
- entity.Property(e => e.Duration)
- .HasColumnType("character varying")
- .HasColumnName("duration");
- entity.Property(e => e.Image)
- .HasColumnType("character varying")
- .HasColumnName("image");
- entity.Property(e => e.Name)
- .HasMaxLength(50)
- .HasColumnName("name");
- entity.Property(e => e.Raiting).HasColumnName("raiting");
- entity.Property(e => e.Trailer)
- .HasColumnType("character varying")
- .HasColumnName("trailer");
- });
- modelBuilder.Entity<FilmAndGenre>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("film_and_genre_pkey");
- entity.ToTable("film_and_genre");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.FilmId)
- .ValueGeneratedOnAdd()
- .HasColumnName("film_id");
- entity.Property(e => e.GenreId)
- .ValueGeneratedOnAdd()
- .HasColumnName("genre_id");
- entity.HasOne(d => d.Film).WithMany(p => p.FilmAndGenres)
- .HasForeignKey(d => d.FilmId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("film_and_genre_film_id_fkey");
- entity.HasOne(d => d.Genre).WithMany(p => p.FilmAndGenres)
- .HasForeignKey(d => d.GenreId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("film_and_genre_genre_id_fkey");
- });
- modelBuilder.Entity<Genre>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("genders_pkey");
- entity.ToTable("genres");
- entity.Property(e => e.Id)
- .HasDefaultValueSql("nextval('genders_id_seq'::regclass)")
- .HasColumnName("id");
- entity.Property(e => e.GenreName)
- .HasColumnType("character varying")
- .HasColumnName("genre_name");
- });
- modelBuilder.Entity<LoginTable>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("login_table_pkey");
- entity.ToTable("login_table");
- entity.HasIndex(e => e.Login, "login_table_unique").IsUnique();
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Iv).HasColumnName("iv");
- entity.Property(e => e.Key).HasColumnName("key");
- entity.Property(e => e.Login)
- .HasColumnType("character varying")
- .HasColumnName("login");
- entity.Property(e => e.Password).HasColumnName("password");
- });
- modelBuilder.Entity<Role>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("roles_pk");
- entity.ToTable("roles");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Title)
- .HasColumnType("character varying")
- .HasColumnName("title");
- });
- modelBuilder.Entity<UserTable>(entity =>
- {
- entity.HasKey(e => e.IdLogin).HasName("user_table_pk");
- entity.ToTable("user_table");
- entity.Property(e => e.IdLogin)
- .ValueGeneratedOnAdd()
- .HasColumnName("id_login");
- entity.Property(e => e.IdRole)
- .ValueGeneratedOnAdd()
- .HasColumnName("id_role");
- entity.Property(e => e.UserName)
- .HasMaxLength(40)
- .HasColumnName("user_name");
- entity.Property(e => e.UserSurname)
- .HasMaxLength(40)
- .HasColumnName("user_surname");
- entity.HasOne(d => d.IdLoginNavigation).WithOne(p => p.UserTable)
- .HasForeignKey<UserTable>(d => d.IdLogin)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("user_table_id_login_fkey");
- entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.UserTables)
- .HasForeignKey(d => d.IdRole)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("user_table_roles_fk");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|