Exemple #1
0
        public override Task CreateViewAsync <TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.IsNotNull(session, nameof(session));
            Ensure.IsNotNull(viewName, nameof(viewName));
            Ensure.IsNotNull(viewOn, nameof(viewOn));
            Ensure.IsNotNull(pipeline, nameof(pipeline));
            options = options ?? new CreateViewOptions <TDocument>();
            var operation = CreateCreateViewOperation(viewName, viewOn, pipeline, options);

            return(ExecuteWriteOperationAsync(session, operation, cancellationToken));
        }
Exemple #2
0
        private CreateViewOperation CreateCreateViewOperation <TDocument, TResult>(string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options)
        {
            var serializerRegistry = options.SerializerRegistry ?? BsonSerializer.SerializerRegistry;
            var documentSerializer = options.DocumentSerializer ?? serializerRegistry.GetSerializer <TDocument>();
            var pipelineDocuments  = pipeline.Render(documentSerializer, serializerRegistry).Documents;

            return(new CreateViewOperation(_databaseNamespace, viewName, viewOn, pipelineDocuments, GetMessageEncoderSettings())
            {
                Collation = options.Collation,
                WriteConcern = _settings.WriteConcern
            });
        }
Exemple #3
0
 public override Task CreateViewAsync <TDocument, TResult>(string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(UsingImplicitSessionAsync(session => CreateViewAsync(session, viewName, viewOn, pipeline, options, cancellationToken), cancellationToken));
 }
Exemple #4
0
 public override void CreateView <TDocument, TResult>(string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     UsingImplicitSession(session => CreateView(session, viewName, viewOn, pipeline, options, cancellationToken), cancellationToken);
 }
        public override void CreateView <TDocument, TResult>(string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.IsNotNull(viewName, nameof(viewName));
            Ensure.IsNotNull(viewOn, nameof(viewOn));
            Ensure.IsNotNull(pipeline, nameof(pipeline));
            options = options ?? new CreateViewOptions <TDocument>();
            var operation = CreateCreateViewOperation(viewName, viewOn, pipeline, options);

            ExecuteWriteOperation(operation, cancellationToken);
        }
Exemple #6
0
 /// <inheritdoc />
 public virtual Task CreateViewAsync <TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 /// <inheritdoc />
 public virtual void CreateView <TDocument, TResult>(string viewName, string viewOn, PipelineDefinition <TDocument, TResult> pipeline, CreateViewOptions <TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }