Esempio n. 1
0
    public MList <S> LookupRequest <K, S>(LookupToken token, K key, MList <S> field)
        where K : notnull
    {
        Dictionary <K, MList <S> > dictionary = (Dictionary <K, MList <S> >)lookups.GetOrCreate(token, () => (IEnumerable) new Dictionary <K, MList <S> >());

        return(dictionary.GetOrCreate(key, () => field != null && field.Count == 0 ? field : new MList <S>()));
    }
Esempio n. 2
0
 internal ChildProjectionExpression(ProjectionExpression projection, Expression outerKey, bool isLazyMList, Type type, LookupToken token)
     : base(DbExpressionType.ChildProjection, type)
 {
     this.Projection  = projection;
     this.OuterKey    = outerKey;
     this.IsLazyMList = isLazyMList;
     this.Token       = token;
 }
Esempio n. 3
0
    public IEnumerable <S> Lookup <K, S>(LookupToken token, K key)
    {
        Lookup <K, S> lookup = (Lookup <K, S>)lookups[token];

        if (!lookup.Contains(key))
        {
            return(Enumerable.Empty <S>());
        }
        else
        {
            return(lookup[key]);
        }
    }
Esempio n. 4
0
        public async IAsyncEnumerable <NuGetReference> SearchAsync(string path, IEnumerable <TargetFrameworkMoniker> tfms, [EnumeratorCancellation] CancellationToken token)
        {
            var lookupToken = LookupToken.Create(path) !;

            if (!lookupToken.HasValue)
            {
                _logger.LogWarning("Could not create a lookup token for {Path}", path);
                yield break;
            }

            foreach (var index in _indexes.Value)
            {
                index.FindNuGetPackageInfo(lookupToken.Value, out var ownerPackageId, out var containingPackage);

                var result = (ownerPackageId, containingPackage) switch
                {
                    { containingPackage : { Id : var id }, } when string.Equals(id, ownerPackageId, StringComparison.OrdinalIgnoreCase) => GetNuGetReference(containingPackage),
                    {
                        containingPackage : { Id : var id }, ownerPackageId : not null
Esempio n. 5
0
 public MList <S> LookupRequest <K, S>(LookupToken token, K key, MList <S> field)
     where K : notnull
 {
     throw new InvalidOperationException("Subqueries can not be used on simple queries");
 }
Esempio n. 6
0
 public IEnumerable <S> Lookup <K, S>(LookupToken token, K key)
 {
     throw new InvalidOperationException("Subqueries can not be used on simple queries");
 }
Esempio n. 7
0
 public EagerChildProjection(LookupToken token, SqlPreCommandSimple command, Expression <Func <IProjectionRow, KeyValuePair <K, V> > > projectorExpression)
 {
     Token               = token;
     Command             = command;
     ProjectorExpression = projectorExpression;
 }
Esempio n. 8
0
 public LazyChildProjection(LookupToken token, SqlPreCommandSimple command, Expression <Func <IProjectionRow, KeyValuePair <K, MList <V> .RowIdElement> > > projectorExpression)
 {
     Token               = token;
     Command             = command;
     ProjectorExpression = projectorExpression;
 }