Skip to content

Commit

Permalink
🎨 test
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonNoCry committed Aug 31, 2023
1 parent 39fc0ab commit 1e9865c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Blog.Core.Api/Controllers/Test/SqlsugarTestController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Blog.Core.Common;
using Blog.Core.Controllers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace Blog.Core.Api.Controllers.Test;

[Route("api/[Controller]/[Action]")]
[AllowAnonymous]
public class SqlsugarTestController : BaseApiController
{
private readonly SqlSugarScope _db;

public SqlsugarTestController(SqlSugarScope db)
{
_db = db;
}

[HttpGet]
public async Task<IActionResult> Get()
{
Console.WriteLine(App.HttpContext.Request.Path);
Console.WriteLine(App.HttpContext.RequestServices.ToString());
Console.WriteLine(App.User?.ID);
await Task.CompletedTask;
return Ok();
}
}
1 change: 1 addition & 0 deletions Blog.Core.Extensions/ServiceExtensions/SqlsugarSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public static void AddSqlsugarSetup(this IServiceCollection services)
});
});
});
services.AddTransient<SqlSugarScope>(s => s.GetService<ISqlSugarClient>() as SqlSugarScope);
}

private static string GetWholeSql(SugarParameter[] paramArr, string sql)
Expand Down

0 comments on commit 1e9865c

Please sign in to comment.