123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using AvaloniaPractic.Models;
- using Microsoft.EntityFrameworkCore;
- namespace AvaloniaApplication2.Models;
- public partial class AppDbContext : DbContext
- {
- public DbSet<User> Users { get; set; } = null!;
- public DbSet<Role> Roles { get; set; } = null!;
- public DbSet<Logined> Logineds { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=3128;Database=pavlov41p;Username=31P;Password=12345");
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.Id).HasName("users_pkey");
- entity.ToTable("users");
- entity.Property(e => e.Id).HasColumnName("id");
- entity.Property(e => e.Createdat)
- .HasDefaultValueSql("CURRENT_TIMESTAMP")
- .HasColumnType("timestamp without time zone")
- .HasColumnName("createdat");
- entity.Property(e => e.Email)
- .HasMaxLength(255)
- .HasColumnName("email");
- entity.Property(e => e.Username)
- .HasMaxLength(100)
- .HasColumnName("username");
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
|