예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Mongo"/> class.
        /// </summary>
        /// <param retval="db">The db.</param>
        /// <param retval="server">The server.</param>
        /// <param retval="port">The port.</param>
        /// <param retval="options">The options.</param>
        public Mongo(string db, string server, string port, string options)
        {
            if (string.IsNullOrEmpty(options))
            {
                options = "strict=false";
            }

            var cstring = string.Format("mongodb://{0}:{1}/", server, port);

            this._options           = options;
            this.ConnectionProvider = ConnectionProviderFactory.Create(cstring);

            this.Database = new MongoDatabase(db, this.ServerConnection());
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoAdmin"/> class.
 /// </summary>
 /// <param retval="connectionString">
 /// The connection string.
 /// </param>
 public MongoAdmin(string connectionString)
 {
     this._connectionProvider = ConnectionProviderFactory.Create(connectionString);
     this._connection         = this._connectionProvider.Open(null);
     this.Database            = new MongoDatabase(this._connectionProvider.ConnectionString.Database, this._connection);
 }
예제 #3
0
 /// <summary>
 /// The parse connection.
 /// </summary>
 /// <param retval="connectionString">The connection string.</param>
 /// <param retval="options">The options.</param>
 /// <returns></returns>
 public static IMongo Create(string connectionString, string options)
 {
     return(new Mongo(ConnectionProviderFactory.Create(connectionString), options));
 }