123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- using System;
- using System.Collections.Generic;
- using Microsoft.EntityFrameworkCore;
- namespace FinancialManagement.Models;
- public partial class ShmelevTeamContext : DbContext
- {
- public ShmelevTeamContext()
- {
- }
- public ShmelevTeamContext(DbContextOptions<ShmelevTeamContext> options)
- : base(options)
- {
- }
- public virtual DbSet<Categoriesfinance> Categoriesfinances { get; set; }
- public virtual DbSet<Category> Categories { get; set; }
- public virtual DbSet<Finance> Finances { get; set; }
- public virtual DbSet<User> Users { 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;Database=shmelev_team;Username=31P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Categoriesfinance>(entity =>
- {
- entity.HasKey(e => e.IdCatFin).HasName("categoriesfinance_pkey");
- entity.ToTable("categoriesfinance");
- entity.Property(e => e.IdCatFin).HasColumnName("id_cat_fin");
- entity.Property(e => e.FinTitle).HasMaxLength(100);
- });
- modelBuilder.Entity<Category>(entity =>
- {
- entity.HasKey(e => e.CategoryId).HasName("category_pkey");
- entity.ToTable("category");
- entity.Property(e => e.CategoryId).HasColumnName("category_id");
- entity.Property(e => e.IdUser).HasColumnName("id_user");
- entity.Property(e => e.Title)
- .HasMaxLength(100)
- .HasColumnName("title");
- entity.HasOne(d => d.IdUserNavigation).WithMany(p => p.Categories)
- .HasForeignKey(d => d.IdUser)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("category_id_user_fkey");
- });
- modelBuilder.Entity<Finance>(entity =>
- {
- entity.HasKey(e => e.FinanceId).HasName("finance_pkey");
- entity.ToTable("finance");
- entity.Property(e => e.FinanceId).HasColumnName("finance_id");
- entity.Property(e => e.CategoryFinId).HasColumnName("category_fin_id");
- entity.Property(e => e.CategoryId).HasColumnName("category_id");
- entity.Property(e => e.DataRecording)
- .HasDefaultValueSql("CURRENT_TIMESTAMP")
- .HasColumnType("timestamp without time zone")
- .HasColumnName("data_recording");
- entity.Property(e => e.Price).HasColumnName("price");
- entity.Property(e => e.Title)
- .HasMaxLength(100)
- .HasColumnName("title");
- entity.Property(e => e.UserId).HasColumnName("user_id");
- entity.HasOne(d => d.CategoryFin).WithMany(p => p.Finances)
- .HasForeignKey(d => d.CategoryFinId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("finance_category_fin_id_fkey");
- entity.HasOne(d => d.Category).WithMany(p => p.Finances)
- .HasForeignKey(d => d.CategoryId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("finance_category_id_fkey");
- entity.HasOne(d => d.User).WithMany(p => p.Finances)
- .HasForeignKey(d => d.UserId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("finance_user_id_fkey");
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.UserId).HasName("users_pkey");
- entity.ToTable("users");
- entity.Property(e => e.UserId).HasColumnName("user_id");
- entity.Property(e => e.Login)
- .HasMaxLength(50)
- .HasColumnName("login");
- entity.Property(e => e.Password)
- .HasMaxLength(50)
- .HasColumnName("password");
- entity.Property(e => e.Phone)
- .HasMaxLength(12)
- .HasColumnName("phone");
- entity.Property(e => e.Username)
- .HasMaxLength(50)
- .HasColumnName("username");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|