Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions WAQS.Client/ttincludes/WAQS.Client.ClientContext.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -3869,7 +3869,8 @@ foreach (EntityType entityType in entityTypes)
var entitySet = (IClientEntitySet<I<#=edmxName#>ClientContext, <#=subEntityTypeFullName#>>)ClientEntitySetExtensions.GetClientEntitySet(entity);
if (entitySet == null)
throw new InvalidOperationException("Load method only works with tracking entities");
var value = await entitySet.AsAsyncQueryable().Where(e => <#+TestKeys(code, entityType, "e", "entity");#>).Select(e => e.<#=propertyName#>).First().Execute<#=asyncSuffix#>(mergeOption);
<#+TestVarKeys(code, entityType, "e", "entity");#>
var value = await entitySet.AsAsyncQueryable().Where(e => <#+TestVarValueKeys(code, entityType, "e", "entity");#>).Select(e => e.<#=propertyName#>).First().Execute<#=asyncSuffix#>(mergeOption);
if (entity.Specifications == null)
entity.Specifications = new <#=clientEntitiesNamespace#>.<#=specificationsClassName#>.<#=specificationsClassName#>Specifications();
entity.Specifications.Has<#=propertyName#> = true;
Expand Down Expand Up @@ -3917,7 +3918,8 @@ foreach (EntityType entityType in entityTypes)
var entitySet = (IClientEntitySet<I<#=edmxName#>ClientContext, <#=entityTypeFullName#>>)ClientEntitySetExtensions.GetClientEntitySet(entity);
if (entitySet == null)
throw new InvalidOperationException("Load method only works with tracking entities");
var value = await entitySet.AsAsyncQueryable().Where(e => <#+TestKeys(code, entityType, "e", "entity");#>).Select(e => e.<#=propertyName#>).First().Execute<#=asyncSuffix#>(mergeOption);
<#+TestVarKeys(code, entityType, "e", "entity");#>
var value = await entitySet.AsAsyncQueryable().Where(e => <#+TestVarValueKeys(code, entityType, "e", "entity");#>).Select(e => e.<#=propertyName#>).First().Execute<#=asyncSuffix#>(mergeOption);
if (entity.Specifications == null)
entity.Specifications = new <#=entityTypeFullName#>.<#=entityTypeName#>Specifications();
entity.Specifications.Has<#=propertyName#> = true;
Expand Down Expand Up @@ -4072,10 +4074,16 @@ foreach (var entityType in entityTypes)
var entitySet = ClientEntitySetExtensions.GetClientEntitySet(entity);
if (mergeOption == MergeOption.NoTracking || entitySet == null)
throw new InvalidOperationException("Load method only works with tracking entities");
<#+if (np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many && np.FromEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
TestVarKeys(code, entityType, "e2", "entity");
} else {
TestVarNavigationKeys(code, np, "entity", "e");
}#>
var value = await ((I<#=contextName#>)entitySet.Context).<#=toEntitySetName#>.AsAsyncQueryable()<#=toEntityType == toEntitySet.ElementType ? "" : string.Concat(".OfType<", clientEntitiesNamespace, ".", toEntityTypeName, ">()")#>.Where(e => <#+
if (np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many && np.FromEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>e.<#=code.Escape(GetOtherNavigationProperty(np))#>.Any(e2 => <#+TestKeys(code, entityType, "entity", "e2");#>)<#+
#>e.<#=code.Escape(GetOtherNavigationProperty(np))#>.Any(e2 => <#+TestVarValueKeys(code, entityType, "e2", "entity");#>)<#+
}
else
TestNavigationKeys(code, np, "entity", "e");
Expand Down
2 changes: 1 addition & 1 deletion WAQS.Server/tools/ttincludes/WAQS.Server.Service.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ var <#=variableName #> = <#=entitySetCollection #>.Local<#=ofType #>.ToList();
var fromQueryable = string.Concat("_context.", code.Escape(fromEntitySet), fromOfType);
#>
var <#=fromEntityTypePlurial #>PredicateAfterTransactionParameter = Expression.Parameter(typeof(<#=fromEntityTypeName #>));
var <#=fromEntityTypePlurial #>PredicateAfterTransaction = Expression.Lambda<Func<<#=fromEntityTypeName #>, bool>>(<#=toEntityNameVariableName #><#=npName #>Ids.Select(idValue =>
var <#=fromEntityTypePlurial #>PredicateAfterTransaction = Expression.Lambda<Func<<#=fromEntityTypeName #>, bool>>(<#=toEntityNameVariableName #><#=npName #>Ids.DefaultIfEmpty().Select(idValue =>
{
<#+
var fksExpressions = new List<string>();
Expand Down
Loading