Description of Connection.
 public CollectionMetaData(string dbName, string name, Connection conn)
 {
     this.connection = conn;
     this.fullName = dbName + "." + name;
     this.name = name;
     this.db = new Database(conn, dbName);
 }
 internal Database(string name, Mongo m)
 {
     Contract.Requires(!string.IsNullOrWhiteSpace(name));
       Contract.Requires(!name.Any(x => @" /\$.".Contains(x)));
       Contract.Requires(m != null);
       _name = name;
       _mongo = m;
       _connection = new Connection(m.Host, m.Port);
       Connection.Open();
 }
Example #3
0
 public Cursor(Connection conn, String fullCollectionName, Document spec, int limit, int skip, Document fields)
 {
     this.connection = conn;
     this.FullCollectionName = fullCollectionName;
     if(spec == null)spec = new Document();
     this.Spec = spec;
     this.Limit = limit;
     this.Skip = skip;
     this.Fields = fields;
 }
Example #4
0
        public void TestSendQueryMessage()
        {
            //Connection conn = new Connection("10.141.153.2");
            Connection conn = new Connection();
            conn.Open();

            BsonDocument qdoc = new BsonDocument();
            qdoc.Add("listDatabases", new BsonNumber(1.0));
            //QueryMessage qmsg = new QueryMessage(qdoc,"system.namespaces");
            QueryMessage qmsg = new QueryMessage(qdoc,"admin.$cmd");
            qmsg.NumberToReturn = -1;
            conn.SendTwoWayMessage(qmsg);

            conn.Close();
        }
Example #5
0
        public Cursor(Connection conn, String fullCollectionName, Document spec, int limit, int skip, Document fields)
        {
            _QueryMessage = new QueryMessage();

            if (spec == null) spec = new Document();
            _QueryMessage.FullCollectionName = fullCollectionName;
            _QueryMessage.NumberToReturn = limit;
            _QueryMessage.NumberToSkip = skip;

            this.connection = conn;
            this.fields = fields;
            this.spec = spec;

            _Special = false;
            _OrderBy = null;
        }
Example #6
0
 public DatabaseMetaData(string name, Connection conn)
 {
     this.connection = conn;
     this.name = name;
     this.db = new Database(conn, name);
 }
Example #7
0
 public Collection(string name, Connection conn, string dbName)
 {
     this.name = name;
     this.connection = conn;
     this.dbName = dbName;
 }
 public MongoCommException(string message, Connection conn, Exception inner)
     : base(message,inner)
 {
     this.host = conn.Host;
     this.port = conn.Port;
 }
 public MongoCommException(string message, Connection conn)
     : this(message,conn,null)
 {
 }
Example #10
0
 public Database(Connection conn, String name)
 {
     this.connection = conn;
     this.name = name;
     this.command = this["$cmd"];
 }
Example #11
0
 static IConnection GetRabbitConnection()
 {
     lock (connectionPool)
     {
         for (int i = 0; i < connectionPool.Count; i++)
         {
             if (connectionPool.ElementAt(i).busy == false && connectionPool.ElementAt(i).connection.IsOpen)
             {
                 connectionPool.ElementAt(i).busy = true;
                 return connectionPool.ElementAt(i).connection;
             }
         }
         Connection newConnection = new Connection();
         newConnection.busy = true;
         newConnection.connection = factory.CreateConnection();
         connectionPool.Add(newConnection);
         return newConnection.connection;
     }
 }
Example #12
0
 public Database(Connection conn, String name)
 {
     this.connection = conn;
     this.name = name;
 }