修复cross join下无法获取分片表对象的bug
This commit is contained in:
parent
5166bf01d7
commit
a944c402a0
|
@ -107,8 +107,14 @@ namespace Sample.MySql.Controllers
|
||||||
name = o.Key.Name,
|
name = o.Key.Name,
|
||||||
count = o.Count()
|
count = o.Count()
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
var x=await (from ut in _defaultTableDbContext.Set<SysTest>()
|
||||||
|
from uu in _defaultTableDbContext.Set<SysUserMod>()
|
||||||
|
where ut.Id == uu.Id
|
||||||
|
select ut).FirstOrDefaultAsync();
|
||||||
|
var x1=await (from ut in _defaultTableDbContext.Set<SysUserMod>()
|
||||||
|
from uu in _defaultTableDbContext.Set<SysTest>()
|
||||||
|
where ut.Id == uu.Id
|
||||||
|
select ut).FirstOrDefaultAsync();
|
||||||
// var firstOrDefault = _defaultTableDbContext.Set<SysUserMod>().FromSqlRaw($"select * from {nameof(SysUserMod)}").FirstOrDefault();
|
// var firstOrDefault = _defaultTableDbContext.Set<SysUserMod>().FromSqlRaw($"select * from {nameof(SysUserMod)}").FirstOrDefault();
|
||||||
|
|
||||||
var sysUserMods1 = _defaultTableDbContext.Set<SysTest>().UseConnectionMode(1)
|
var sysUserMods1 = _defaultTableDbContext.Set<SysTest>().UseConnectionMode(1)
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
|
||||||
return base.VisitExtension(node);
|
return base.VisitExtension(node);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private void TryAddShardingEntities(Type entityType, IQueryable queryable)
|
private void TryAddShardingEntities(Type entityType, IQueryable queryable)
|
||||||
{
|
{
|
||||||
if (!shardingEntities.ContainsKey(entityType))
|
if (!shardingEntities.ContainsKey(entityType))
|
||||||
|
@ -130,10 +131,14 @@ namespace ShardingCore.Sharding.Parsers.Visitors
|
||||||
case nameof(EntityFrameworkQueryableExtensions.AsNoTracking): isNoTracking = true; break;
|
case nameof(EntityFrameworkQueryableExtensions.AsNoTracking): isNoTracking = true; break;
|
||||||
case nameof(EntityFrameworkQueryableExtensions.AsTracking): isNoTracking = false; break;
|
case nameof(EntityFrameworkQueryableExtensions.AsTracking): isNoTracking = false; break;
|
||||||
case nameof(EntityFrameworkQueryableExtensions.IgnoreQueryFilters): isIgnoreFilter = true; break;
|
case nameof(EntityFrameworkQueryableExtensions.IgnoreQueryFilters): isIgnoreFilter = true; break;
|
||||||
case nameof(EntityFrameworkQueryableExtensions.Include):
|
// case nameof(EntityFrameworkQueryableExtensions.Include):
|
||||||
case nameof(EntityFrameworkQueryableExtensions.ThenInclude): DiscoverQueryEntities(node); break;
|
// case nameof(EntityFrameworkQueryableExtensions.ThenInclude): DiscoverQueryEntities(node); break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
if (node.Method.ReturnType.IsMethodReturnTypeQueryableType()&&node.Method.ReturnType.IsGenericType)
|
||||||
|
{
|
||||||
|
DiscoverQueryEntities(node);
|
||||||
|
}
|
||||||
var customerExpression = DiscoverCustomerQueryEntities(node);
|
var customerExpression = DiscoverCustomerQueryEntities(node);
|
||||||
if (customerExpression != null)
|
if (customerExpression != null)
|
||||||
{
|
{
|
||||||
|
@ -199,6 +204,7 @@ namespace ShardingCore.Sharding.Parsers.Visitors
|
||||||
for (var i = 0; i < genericArguments.Length; i++)
|
for (var i = 0; i < genericArguments.Length; i++)
|
||||||
{
|
{
|
||||||
var genericArgument = genericArguments[i];
|
var genericArgument = genericArguments[i];
|
||||||
|
|
||||||
if (typeof(IEnumerable).IsAssignableFrom(genericArgument))
|
if (typeof(IEnumerable).IsAssignableFrom(genericArgument))
|
||||||
{
|
{
|
||||||
var arguments = genericArgument.GetGenericArguments();
|
var arguments = genericArgument.GetGenericArguments();
|
||||||
|
|
Loading…
Reference in New Issue