예제 #1
0
 public static Task <TResult> LoadDocumentAs <T, TResult>(
     this IMongoDatabase database,
     string id,
     Func <ProjectionDefinitionBuilder <T>, ProjectionDefinition <T> > projection,
     MongoCollectionName collectionName,
     CancellationToken cancellationToken = default
     ) where T : Document
 => database.GetDocumentCollection <T>(collectionName).LoadDocumentAs <T, TResult>(id, projection, cancellationToken);
예제 #2
0
 public static Task <TResult> LoadDocumentAs <T, TResult>(
     this IMongoDatabase database,
     string id,
     Expression <Func <T, TResult> > projection,
     MongoCollectionName collectionName,
     CancellationToken cancellationToken = default
     ) where T : Document
 => database.GetDocumentCollection <T>(collectionName).LoadDocumentAs(id, projection, cancellationToken);
        public static IMongoQueryable <T> AsQueryable <T>(
            this IMongoDatabase database,
            MongoCollectionName collectionName,
            Action <AggregateOptions> configure = null
            ) where T : Document
        {
            var options = new AggregateOptions();

            configure?.Invoke(options);

            return(database.GetDocumentCollection <T>(collectionName).AsQueryable(options));
        }
예제 #4
0
 public static IMongoCollection <T> GetDocumentCollection <T>(
     this IMongoDatabase database,
     MongoCollectionName collectionName,
     MongoCollectionSettings settings
     ) where T : Document
 => database.GetCollection <T>(collectionName == null ? MongoCollectionName.For <T>() : collectionName, settings);
예제 #5
0
 public static IMongoCollection <T> GetDocumentCollection <T>(
     this IMongoDatabase database,
     MongoCollectionSettings settings
     ) where T : Document
 => GetDocumentCollection <T>(database, MongoCollectionName.For <T>(), settings);
예제 #6
0
 public static IMongoCollection <T> GetDocumentCollection <T>(this IMongoDatabase database, MongoCollectionName collectionName = null)
     where T : Document
 => GetDocumentCollection <T>(database, collectionName ?? MongoCollectionName.For <T>(), null);