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 Directors { get; set; } public virtual DbSet DirectorsAndFilms { get; set; } public virtual DbSet Films { get; set; } public virtual DbSet FilmAndGenres { get; set; } public virtual DbSet Genres { get; set; } public virtual DbSet LoginTables { get; set; } public virtual DbSet Roles { get; set; } public virtual DbSet 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(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(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(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(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(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(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(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(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(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); }