//using asg_form.Controllers.Budget; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System.Security.Cryptography; using System.Text; namespace asg_form.Controllers { class schgameConfig : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("F_game"); builder.Property(e => e.team1_name).IsRequired(); builder.Property(e => e.team1_piaoshu).IsRequired(); builder.Property(e => e.team2_name).IsRequired(); builder.Property(e => e.team2_piaoshu).IsRequired(); builder.Property(e => e.opentime).IsRequired(); } } class RoleConfig : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("F_role"); builder.Property(e => e.role_id).IsRequired(); builder.Property(e => e.role_lin).IsRequired(); builder.Property(e => e.role_name).IsRequired(); } } public class role { public long Id { get; set; } public string role_id { get; set; } = "无"; public string role_name { get; set; } = "无";//阵容 public string? Game_Name { get; set; } = "未知"; public string role_lin { get; set; } public string? Id_Card { get; set; } = "未知"; public string? Common_Roles { get; set; } = "未知"; public string? Phone_Number { get; set; } = "未知"; public string? Id_Card_Name { get; set; } = "未知"; public int? Historical_Ranks { get; set; } = 0; } public class team_game { public long id { get; set; } public string team1_name { get; set; } public int team1_piaoshu { get; set; } public string team2_name { get; set; } public int team2_piaoshu { get; set; } public DateTime opentime { get; set; } /// /// 解说的名字,用逗号隔开!!!!!!! /// public string commentary { get; set; } /// /// 裁判的名字 /// public string referee { get; set; } /// /// bilibili录屏路径 /// public Uri? bilibiliuri { get; set; } public string? winteam { get; set; } public string? tag { get; set; } public string? belong { get; set; } } class TestDbContext : DbContext { public DbSet Roles { get; set; } public DbSet team_Games { get; set; } //public DbSet budgetDetails { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;"; optionsBuilder.UseNpgsql(connStr); } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly); } } }