2021-12-11 15:24:47 +01:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using zero.Context;
|
|
|
|
|
using zero.Identity;
|
|
|
|
|
using zero.Stores;
|
|
|
|
|
|
|
|
|
|
namespace zero.Demo.Controllers;
|
|
|
|
|
|
2021-12-14 11:25:32 +01:00
|
|
|
public class TestController : ControllerBase
|
2021-12-11 15:24:47 +01:00
|
|
|
{
|
2021-12-14 11:25:32 +01:00
|
|
|
[HttpGet("")]
|
|
|
|
|
public ActionResult Get(string id, string changeVector = null)
|
|
|
|
|
{
|
|
|
|
|
return new JsonResult(new
|
|
|
|
|
{
|
|
|
|
|
id = id
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("/test/url")]
|
|
|
|
|
public ActionResult GetUrl()
|
|
|
|
|
{
|
|
|
|
|
return new JsonResult(new
|
|
|
|
|
{
|
|
|
|
|
url = Url.Action("Get", new { id = "myid" })
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 15:17:47 +01:00
|
|
|
//[HttpGet]
|
|
|
|
|
//public async Task<ActionResult> Scoping([FromServices] IZeroContext ctx, [FromServices] IStoreOperations ops)
|
|
|
|
|
//{
|
|
|
|
|
// string scopeA = null;
|
|
|
|
|
// string scopeB = null;
|
|
|
|
|
// string scopeC = null;
|
|
|
|
|
// List<ZeroUser> usersA = new();
|
|
|
|
|
// List<ZeroUser> usersB = new();
|
2021-12-11 15:24:47 +01:00
|
|
|
|
2021-12-13 15:17:47 +01:00
|
|
|
// scopeA = ctx.Store.ResolvedDatabase;
|
2021-12-11 15:24:47 +01:00
|
|
|
|
2021-12-13 15:17:47 +01:00
|
|
|
// using (var scope = ctx.CreateScope("laola"))
|
|
|
|
|
// {
|
|
|
|
|
// scopeB = ctx.Store.ResolvedDatabase;
|
|
|
|
|
// usersA = await ops.LoadAll<ZeroUser>();
|
|
|
|
|
// }
|
2021-12-11 15:24:47 +01:00
|
|
|
|
2021-12-13 15:17:47 +01:00
|
|
|
// scopeC = ctx.Store.ResolvedDatabase;
|
|
|
|
|
// usersB = await ops.LoadAll<ZeroUser>();
|
2021-12-11 15:24:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-13 15:17:47 +01:00
|
|
|
// return Json(new
|
|
|
|
|
// {
|
|
|
|
|
// scopeA,
|
|
|
|
|
// scopeB,
|
|
|
|
|
// scopeC,
|
|
|
|
|
// usersA,
|
|
|
|
|
// usersB
|
|
|
|
|
// });
|
|
|
|
|
//}
|
2021-12-11 15:24:47 +01:00
|
|
|
}
|