From 8286a287213ec40c9dcb83bac485c4c1dfea23c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=AF=85?= <2667210109@qq.com> Date: Wed, 2 Oct 2024 03:03:20 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=B8=BApgsql=EF=BC=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5c36b57326886ae06602c2d54e556629168d9b5b. --- 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, 9 insertions(+), 12 deletions(-) diff --git a/asg_form/Controllers/Budget/BgCountController.cs b/asg_form/Controllers/Budget/BgCountController.cs index 8f77230..2b5d292 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,4 +91,3 @@ 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 90d5949..c0a8f9e 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 = @"Host=localhost;Port=2345;Database=postgres;Username=postgres;Password=luolan12323;"; - optionsBuilder.UseNpgsql(connStr); + string connStr = @"Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;TrustServerCertificate=true"; + optionsBuilder.UseSqlServer(connStr); } protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/asg_form/Program.cs b/asg_form/Program.cs index 0232e5a..5429906 100644 --- a/asg_form/Program.cs +++ b/asg_form/Program.cs @@ -8,7 +8,6 @@ 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; @@ -81,8 +80,8 @@ IServiceCollection services = builder.Services; services.AddDbContext(opt => { - string connStr = @"Host=localhost;Port=2345;Database=postgres;Username=postgres;Password=luolan12323;"; - opt.UseNpgsql(connStr); + string connStr = @"Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;TrustServerCertificate=true"; + opt.UseSqlServer(connStr); }); services.AddHostedService(); diff --git a/asg_form/asg_form.csproj b/asg_form/asg_form.csproj index 9054eaf..12f488a 100644 --- a/asg_form/asg_form.csproj +++ b/asg_form/asg_form.csproj @@ -27,7 +27,7 @@ - + @@ -48,13 +48,12 @@ - - +