private LoadLinkProtocolForLinkedSourceBuilder <TLinkedSource> LoadLinkNestedLinkedSourcesByIds <TChildLinkedSource, TId>( Func <TLinkedSource, IEnumerable <TId> > getLookupIds, ILinkTarget <TLinkedSource, TChildLinkedSource> linkTarget, Action <TLinkedSource, int, TChildLinkedSource> initChildLinkedSource = null) { var include = LinkedSourceConfigs.GetConfigFor <TChildLinkedSource>() .CreateIncludeNestedLinkedSourceById <TLinkedSource, TChildLinkedSource, TId, TId>( id => id, initChildLinkedSource ); return(AddNonPolymorphicLoadLinkExpression( getLookupIds, linkTarget, include )); }
/// <summary> /// Load and link a nested linked source by ID when the polymorphic link matches the <paramref name="discriminantValue"/>. /// </summary> public IncludeSetBuilder <TLinkedSource, TAbstractLinkTarget, TLink, TDiscriminant> AsNestedLinkedSourceById <TId>( TDiscriminant discriminantValue, Func <TLink, TId> getLookupId, Action <TLinkedSource, int, TLinkTarget> initChildLinkedSource = null) { if (getLookupId == null) { throw new ArgumentNullException(nameof(getLookupId)); } var include = LinkedSourceConfigs.GetConfigFor <TLinkTarget>() .CreateIncludeNestedLinkedSourceById <TLinkedSource, TAbstractLinkTarget, TLink, TId>( getLookupId, initChildLinkedSource ); _includeSetBuilder.AddToIncludeSet( discriminantValue, include ); return(_includeSetBuilder); }
/// <summary> /// Load and link a nested linked source using a model from the parent linked source when the polymorphic link matches the <paramref name="discriminantValue"/>. /// </summary> public IncludeSetBuilder <TLinkedSource, TAbstractLinkTarget, TLink, TDiscriminant> AsNestedLinkedSourceFromModel <TChildLinkedSourceModel>( TDiscriminant discriminantValue, Func <TLink, TChildLinkedSourceModel> getNestedLinkedSourceModel, Action <TLink, TLinkTarget> initChildLinkedSource) { if (getNestedLinkedSourceModel == null) { throw new ArgumentNullException(nameof(getNestedLinkedSourceModel)); } var include = LinkedSourceConfigs.GetConfigFor <TLinkTarget>() .CreateIncludeNestedLinkedSourceFromModel <TLinkedSource, TAbstractLinkTarget, TLink, TChildLinkedSourceModel>( getNestedLinkedSourceModel, _includeSetBuilder.LinkTarget, initChildLinkedSource ); _includeSetBuilder.AddToIncludeSet( discriminantValue, include ); return(_includeSetBuilder); }