private LoadLinkProtocolForLinkedSourceBuilder <TLinkedSource> LoadLinkPolymorphic <TAbstractLinkTarget, TLink, TDiscriminant>(
            Func <TLinkedSource, IEnumerable <TLink> > getLinks,
            ILinkTarget <TLinkedSource, TAbstractLinkTarget> linkTarget,
            Func <TLink, TDiscriminant> getDiscriminant,
            Action <IncludeSetBuilder <TLinkedSource, TAbstractLinkTarget, TLink, TDiscriminant> > includes, bool ignoreUnhandledCases)
        {
            var includeBuilder = new IncludeSetBuilder <TLinkedSource, TAbstractLinkTarget, TLink, TDiscriminant>(linkTarget);

            includes(includeBuilder);

            var loadLinkExpression = new LoadLinkExpressionImpl <TLinkedSource, TAbstractLinkTarget, TLink, TDiscriminant>(
                getLinks,
                linkTarget,
                includeBuilder.Build(getDiscriminant, ignoreUnhandledCases)
                );

            return(AddLoadLinkExpression(loadLinkExpression));
        }
Exemplo n.º 2
0
        private LoadLinkProtocolForLinkedSourceBuilder <TLinkedSource> AddNonPolymorphicLoadLinkExpression <TTargetProperty, TId>(
            Func <TLinkedSource, IEnumerable <TId> > getLookupIds,
            ILinkTarget <TLinkedSource, TTargetProperty> linkTarget,
            IInclude include)
        {
            var loadLinkExpression = new LoadLinkExpressionImpl <TLinkedSource, TTargetProperty, TId, bool>(
                getLookupIds,
                linkTarget,
                new IncludeSet <TLinkedSource, TTargetProperty, TId, bool>(
                    new Dictionary <bool, IInclude>
            {
                {
                    true,         //always one include when not polymorphic
                    include
                }
            },
                    link => true
                    )
                );

            return(AddLoadLinkExpression(loadLinkExpression));
        }