From 5c36b57326886ae06602c2d54e556629168d9b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=AF=85?= <2667210109@qq.com> Date: Tue, 1 Oct 2024 23:04:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=B8=BApgsql=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asg_form/Controllers/Budget/BgCountController.cs | 3 ++- asg_form/Controllers/Dbset.cs | 8 ++++---- asg_form/Program.cs | 5 +++-- asg_form/asg_form.csproj | 5 +++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/asg_form/Controllers/Budget/BgCountController.cs b/asg_form/Controllers/Budget/BgCountController.cs index 2b5d292..8f77230 100644 --- a/asg_form/Controllers/Budget/BgCountController.cs +++ b/asg_form/Controllers/Budget/BgCountController.cs @@ -1,4 +1,4 @@ -using asg_form.Controllers.Teamregistration; +/*using asg_form.Controllers.Teamregistration; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -91,3 +91,4 @@ namespace asg_form.Controllers.Budget } } } +*/ \ No newline at end of file diff --git a/asg_form/Controllers/Dbset.cs b/asg_form/Controllers/Dbset.cs index c0a8f9e..90d5949 100644 --- a/asg_form/Controllers/Dbset.cs +++ b/asg_form/Controllers/Dbset.cs @@ -1,5 +1,5 @@  -using asg_form.Controllers.Budget; +//using asg_form.Controllers.Budget; using asg_form.Controllers.Store; using asg_form.Controllers.Team; using asg_form.Controllers.Teamregistration; @@ -240,12 +240,12 @@ namespace asg_form.Controllers public DbSet T_config { get; set; } public DbSet T_Task { get; set; } public DbSet T_Comform { get; set; } - public DbSet budgetDetails { get; set; } + //public DbSet budgetDetails { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - string connStr = @"Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;TrustServerCertificate=true"; - optionsBuilder.UseSqlServer(connStr); + string connStr = @"Host=localhost;Port=2345;Database=postgres;Username=postgres;Password=luolan12323;"; + optionsBuilder.UseNpgsql(connStr); } protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/asg_form/Program.cs b/asg_form/Program.cs index 5429906..0232e5a 100644 --- a/asg_form/Program.cs +++ b/asg_form/Program.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using Mirai.Net.Sessions; @@ -80,8 +81,8 @@ IServiceCollection services = builder.Services; services.AddDbContext(opt => { - string connStr = @"Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;TrustServerCertificate=true"; - opt.UseSqlServer(connStr); + string connStr = @"Host=localhost;Port=2345;Database=postgres;Username=postgres;Password=luolan12323;"; + opt.UseNpgsql(connStr); }); services.AddHostedService(); diff --git a/asg_form/asg_form.csproj b/asg_form/asg_form.csproj index 12f488a..9054eaf 100644 --- a/asg_form/asg_form.csproj +++ b/asg_form/asg_form.csproj @@ -27,7 +27,7 @@ - + @@ -48,12 +48,13 @@ + - +