/// <summary>
 /// Initializes a new instance of the <see cref="GridFSBucketOptions"/> class.
 /// </summary>
 /// <param name="other">The other <see cref="ImmutableGridFSBucketOptions"/> from which to copy the values.</param>
 public GridFSBucketOptions(ImmutableGridFSBucketOptions other)
 {
     _bucketName = other.BucketName;
     _chunkSizeBytes = other.ChunkSizeBytes;
     _readPreference = other.ReadPreference;
     _writeConcern = other.WriteConcern;
 }
        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="GridFSBucket" /> class.
        /// </summary>
        /// <param name="database">The database.</param>
        /// <param name="options">The options.</param>
        public GridFSBucket(IMongoDatabase database, GridFSBucketOptions options = null)
        {
            _database = Ensure.IsNotNull(database, nameof(database));
            _options = options == null ? ImmutableGridFSBucketOptions.Defaults : new ImmutableGridFSBucketOptions(options);

            _cluster = database.Client.Cluster;
            _ensuredIndexes = 0;
        }
示例#3
0
        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="GridFSBucket" /> class.
        /// </summary>
        /// <param name="database">The database.</param>
        /// <param name="options">The options.</param>
        public GridFSBucket(IMongoDatabase database, GridFSBucketOptions options = null)
        {
            _database = Ensure.IsNotNull(database, nameof(database));
            _options  = options == null ? ImmutableGridFSBucketOptions.Defaults : new ImmutableGridFSBucketOptions(options);

            _cluster        = database.Client.Cluster;
            _ensuredIndexes = 0;
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridFSBucketOptions"/> class.
 /// </summary>
 /// <param name="other">The other <see cref="ImmutableGridFSBucketOptions"/> from which to copy the values.</param>
 public GridFSBucketOptions(ImmutableGridFSBucketOptions other)
 {
     Ensure.IsNotNull(other, nameof(other));
     _bucketName     = other.BucketName;
     _chunkSizeBytes = other.ChunkSizeBytes;
     _readPreference = other.ReadPreference;
     _writeConcern   = other.WriteConcern;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GridFSBucketOptions"/> class.
 /// </summary>
 /// <param name="other">The other <see cref="ImmutableGridFSBucketOptions"/> from which to copy the values.</param>
 public GridFSBucketOptions(ImmutableGridFSBucketOptions other)
 {
     Ensure.IsNotNull(other, nameof(other));
     _bucketName = other.BucketName;
     _chunkSizeBytes = other.ChunkSizeBytes;
     _readConcern = other.ReadConcern;
     _readPreference = other.ReadPreference;
     _writeConcern = other.WriteConcern;
 }
示例#6
0
        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="GridFSBucket" /> class.
        /// </summary>
        /// <param name="database">The database.</param>
        /// <param name="options">The options.</param>
        public GridFSBucket(IMongoDatabase database, GridFSBucketOptions options = null)
        {
            _database = Ensure.IsNotNull(database, nameof(database));
            _options  = options == null ? ImmutableGridFSBucketOptions.Defaults : new ImmutableGridFSBucketOptions(options);

            _cluster = database.Client.Cluster;

            var idSerializer = _options.SerializerRegistry.GetSerializer <TFileId>();

            _idSerializationInfo = new BsonSerializationInfo("_id", idSerializer, typeof(TFileId));
            _fileInfoSerializer  = new GridFSFileInfoSerializer <TFileId>(idSerializer);
        }