Esempio n. 1
0
        public MongoEventStore(string connectionString, ITypeCatalog typeCatalog)
        {
            var connectionStringBuilder = new MongoConnectionStringBuilder(connectionString);
            var configuration = BuildMongoConfiguration(typeCatalog, connectionString);
            var mongo = new Mongo(configuration);
            mongo.Connect();

            database = mongo.GetDatabase(connectionStringBuilder.Database);
        }
Esempio n. 2
0
        private string BuildMongoConnectionString(MongoDriveParameters driveParameters, PSCredential credential)
        {
            string cxn = BuildMongoConnectionString(driveParameters);

            if( null != credential &&
                null != credential.UserName &&
                null != credential.Password )
            {
                MongoConnectionStringBuilder builder = new MongoConnectionStringBuilder( cxn );
                builder.Username = credential.UserName;
                builder.Password = credential.Password.ToUnsecureString();
                cxn = builder.ToString();
            }

            return cxn;
        }
Esempio n. 3
0
 public MongoEventStore(string connectionString, ITypeCatalog typeCatalog)
 {
     var connectionStringBuilder = new MongoConnectionStringBuilder(connectionString);
     databaseName = connectionStringBuilder.Database;
     configuration = BuildMongoConfiguration(typeCatalog, connectionString);
 }
Esempio n. 4
0
        private string BuildMongoConnectionString(MongoDriveParameters driveParameters)
        {
            if( null != driveParameters.ConnectionString )
            {
                return driveParameters.ConnectionString;
            }

            MongoConnectionStringBuilder builder = new MongoConnectionStringBuilder();
            driveParameters.Servers.ToList().ForEach( builder.AddServer );
            builder.Pooled = driveParameters.Pooled.IsPresent;
            builder.ConnectionLifetime = driveParameters.ConnectionLifetime;
            builder.ConnectionTimeout = driveParameters.ConnectionTimeout;
            builder.MaximumPoolSize = driveParameters.MaximumPoolSize;
            builder.MinimumPoolSize = driveParameters.MinimumPoolSize;

            return builder.ToString();
        }