public LookupInResult(ILookupInResult inner)
        {
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (inner == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(inner));
            }
            if (inner is not ITypeSerializerProvider)
            {
                ThrowHelper.ThrowNotSupportedException("The class implementing ILookupInResult must also implement ITypeSerializerProvider.");
            }

            _inner = inner;
        }
 internal DocumentLookupResult(
     string id,
     IContentAsWrapper?unstagedContent,
     IContentAsWrapper?stagedContent,
     ILookupInResult lookupInResult,
     DocumentMetadata documentMetadata,
     ICouchbaseCollection documentCollection)
 {
     Id                 = id;
     LookupInResult     = lookupInResult;
     StagedContent      = stagedContent;
     UnstagedContent    = unstagedContent;
     DocumentMetadata   = documentMetadata;
     DocumentCollection = documentCollection;
 }
Example #3
0
        public static bool Exists <TDocument, TContent>(this ILookupInResult <TDocument> result, Expression <Func <TDocument, TContent> > path)
        {
            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            if (result == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(result));
            }
            if (path == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(path));
            }
            // ReSharper restore ConditionIsAlwaysTrueOrFalse

            var pathString = SubDocumentPathExpressionVisitor.GetPath(result, path);
            var index      = result.IndexOf(pathString);

            if (index < 0)
            {
                ThrowHelper.ThrowArgumentException(nameof(path), $"Path '{pathString}' is not found.");
            }

            return(result.Exists(index));
        }
Example #4
0
 public LookupInContentAsWrapper(ILookupInResult lookupInResult, int specIndex)
 {
     _lookupInResult = lookupInResult;
     _specIndex      = specIndex;
 }