mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 移除 fsql.GetGuidRepository 改用 fsql.GetRepository<T, Guid>();
This commit is contained in:
parent
d3904ffdd3
commit
c01b4c8e10
@ -43,6 +43,18 @@ namespace restful.Controllers
|
|||||||
Console.Write(reposTest.Select.ToSql());
|
Console.Write(reposTest.Select.ToSql());
|
||||||
|
|
||||||
_songRepository = repos4;
|
_songRepository = repos4;
|
||||||
|
|
||||||
|
//test code
|
||||||
|
var curd1 = fsql.GetRepository<Song, int>();
|
||||||
|
var curd2 = fsql.GetRepository<Song, string>();
|
||||||
|
var curd3 = fsql.GetRepository<Song, Guid>();
|
||||||
|
|
||||||
|
Console.WriteLine(reposSong.Select.ToSql());
|
||||||
|
|
||||||
|
using (reposSong.DataFilter.DisableAll())
|
||||||
|
{
|
||||||
|
Console.WriteLine(reposSong.Select.ToSql());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||||
<PackageReference Include="Npgsql" Version="6.0.11" />
|
|
||||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
|
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
|
@ -65,23 +65,23 @@ WHERE (exists(SELECT 1
|
|||||||
limit 0,1))
|
limit 0,1))
|
||||||
ORDER BY a.""Id"" DESC", sql);
|
ORDER BY a.""Id"" DESC", sql);
|
||||||
|
|
||||||
// using (userRepository.DataFilter.Disable("TenantQuery"))
|
using (userRepository.DataFilter.Disable("TenantQuery"))
|
||||||
// {
|
{
|
||||||
// sql = userRepository.Select
|
sql = userRepository.Select
|
||||||
// .Where(i => i.DoorDevices.AsSelect().Any(x => x.Id == deviceId))
|
.Where(i => i.DoorDevices.AsSelect().Any(x => x.Id == deviceId))
|
||||||
// .OrderByDescending(true, a => a.Id)
|
.OrderByDescending(true, a => a.Id)
|
||||||
// .ToSql();
|
.ToSql();
|
||||||
// Assert.Equal(@"SELECT a.""Id"", a.""TenantId""
|
Assert.Equal(@"SELECT a.""Id"", a.""TenantId""
|
||||||
//FROM ""issues1208_User"" a
|
FROM ""issues1208_User"" a
|
||||||
//WHERE (exists(SELECT 1
|
WHERE (exists(SELECT 1
|
||||||
// FROM ""issues1208_DoorDeviceUser"" Mx_Mi
|
FROM ""issues1208_DoorDeviceUser"" Mx_Mi
|
||||||
// WHERE (Mx_Mi.""UserId"" = a.""Id"") AND (exists(SELECT 1
|
WHERE (Mx_Mi.""UserId"" = a.""Id"") AND (exists(SELECT 1
|
||||||
// FROM ""issues1208_DoorDevice"" x
|
FROM ""issues1208_DoorDevice"" x
|
||||||
// WHERE (x.""Id"" = 100) AND (x.""Id"" = Mx_Mi.""DoorDeviceId"")
|
WHERE (x.""Id"" = 100) AND (x.""Id"" = Mx_Mi.""DoorDeviceId"")
|
||||||
// limit 0,1))
|
limit 0,1))
|
||||||
// limit 0,1))
|
limit 0,1))
|
||||||
//ORDER BY a.""Id"" DESC", sql);
|
ORDER BY a.""Id"" DESC", sql);
|
||||||
// }
|
}
|
||||||
|
|
||||||
sql = userRepository.Select
|
sql = userRepository.Select
|
||||||
.Where(i => i.DoorDevices.Any(x => x.Id == deviceId))
|
.Where(i => i.DoorDevices.Any(x => x.Id == deviceId))
|
||||||
@ -113,23 +113,23 @@ WHERE (exists(SELECT 1
|
|||||||
limit 0,1))
|
limit 0,1))
|
||||||
ORDER BY a.""Id"" DESC", sql);
|
ORDER BY a.""Id"" DESC", sql);
|
||||||
|
|
||||||
// using (userRepository.DataFilter.Disable("TenantQuery"))
|
using (userRepository.DataFilter.Disable("TenantQuery"))
|
||||||
// {
|
{
|
||||||
// sql = userRepository.Select
|
sql = userRepository.Select
|
||||||
// .Where(i => i.DoorDevices.Any(x => x.Id == deviceId))
|
.Where(i => i.DoorDevices.Any(x => x.Id == deviceId))
|
||||||
// .OrderByDescending(true, a => a.Id)
|
.OrderByDescending(true, a => a.Id)
|
||||||
// .ToSql();
|
.ToSql();
|
||||||
// Assert.Equal(@"SELECT a.""Id"", a.""TenantId""
|
Assert.Equal(@"SELECT a.""Id"", a.""TenantId""
|
||||||
//FROM ""issues1208_User"" a
|
FROM ""issues1208_User"" a
|
||||||
//WHERE (exists(SELECT 1
|
WHERE (exists(SELECT 1
|
||||||
// FROM ""issues1208_DoorDevice"" x
|
FROM ""issues1208_DoorDevice"" x
|
||||||
// WHERE (exists(SELECT 1
|
WHERE (exists(SELECT 1
|
||||||
// FROM ""issues1208_DoorDeviceUser"" Mx_Ma
|
FROM ""issues1208_DoorDeviceUser"" Mx_Ma
|
||||||
// WHERE (Mx_Ma.""DoorDeviceId"" = x.""Id"") AND (Mx_Ma.""UserId"" = a.""Id"")
|
WHERE (Mx_Ma.""DoorDeviceId"" = x.""Id"") AND (Mx_Ma.""UserId"" = a.""Id"")
|
||||||
// limit 0,1)) AND (x.""Id"" = 100)
|
limit 0,1)) AND (x.""Id"" = 100)
|
||||||
// limit 0,1))
|
limit 0,1))
|
||||||
//ORDER BY a.""Id"" DESC", sql);
|
ORDER BY a.""Id"" DESC", sql);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,6 +382,16 @@ namespace FreeSql.Tests
|
|||||||
var gft2 = g.mysql.Select<gf_t2>().Where(a => a.id == Guid.NewGuid()).ToList();
|
var gft2 = g.mysql.Select<gf_t2>().Where(a => a.id == Guid.NewGuid()).ToList();
|
||||||
var gft3 = g.mysql.Select<gf_t3>().Where(a => a.id == Guid.NewGuid()).ToList();
|
var gft3 = g.mysql.Select<gf_t3>().Where(a => a.id == Guid.NewGuid()).ToList();
|
||||||
|
|
||||||
|
var repo1 = g.mysql.GetRepository<gf_t1, Guid>();
|
||||||
|
using (repo1.DataFilter.Disable("gft1", "gft2", "gft3"))
|
||||||
|
repo1.Get(Guid.NewGuid());
|
||||||
|
var repo2 = g.mysql.GetRepository<gf_t2, Guid>();
|
||||||
|
using (repo2.DataFilter.Disable("gft1", "gft2", "gft3"))
|
||||||
|
repo2.Get(Guid.NewGuid());
|
||||||
|
var repo3 = g.mysql.GetRepository<gf_t3, Guid>();
|
||||||
|
using (repo3.DataFilter.Disable("gft1", "gft2", "gft3"))
|
||||||
|
repo3.Get(Guid.NewGuid());
|
||||||
|
|
||||||
g.sqlserver.Delete<TBatInst>().Where("1=1").ExecuteAffrows();
|
g.sqlserver.Delete<TBatInst>().Where("1=1").ExecuteAffrows();
|
||||||
g.mysql.Delete<TBatInst>().Where("1=1").ExecuteAffrows();
|
g.mysql.Delete<TBatInst>().Where("1=1").ExecuteAffrows();
|
||||||
g.pgsql.Delete<TBatInst>().Where("1=1").ExecuteAffrows();
|
g.pgsql.Delete<TBatInst>().Where("1=1").ExecuteAffrows();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using Npgsql;
|
using Npgsql;
|
||||||
using Npgsql.Internal;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user