Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Nequeo.Data.MongoDb.Connection conn   = new Nequeo.Data.MongoDb.Connection("nequeompc");
            Nequeo.Data.MongoDb.DataAccess access = new Nequeo.Data.MongoDb.DataAccess(conn);
            MongoDatabase database = access.GetDatabase("nequeo");

            Nequeo.Data.MongoDb.CodeDom.BsonDocumentModel bson = new Nequeo.Data.MongoDb.CodeDom.BsonDocumentModel();
            int ret = bson.Generate(database, @"c:\temp\mongodb\", "Nequeo.MongoDb.Database");
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Nequeo.Data.MongoDb.Connection conn   = new Nequeo.Data.MongoDb.Connection("nequeompc");
            Nequeo.Data.MongoDb.DataAccess access = new Nequeo.Data.MongoDb.DataAccess(conn);
            MongoDatabase database = access.GetDatabase("nequeo");
            MongoCollection <BsonDocument> collb = access.GetCollection(database, "User");
            BsonDocument document = access.FindAll(collb, limit: 1).ToArray().First();

            Nequeo.Data.MongoDb.CodeDom.BsonDocumentModel  bson  = new Nequeo.Data.MongoDb.CodeDom.BsonDocumentModel();
            Nequeo.Data.MongoDb.CodeDom.BsonModelContainer model = new Nequeo.Data.MongoDb.CodeDom.BsonModelContainer();
            model.ClassName    = "User";
            model.Namespace    = "Nequeo.MongoDb";
            model.BsonDocument = document;
            model.AssignProperties();

            System.CodeDom.CodeCompileUnit unit = bson.Generate(model);
            bson.CreateCodeFile(@"C:\Temp\BsonDocModel.cs", unit);
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Nequeo.Data.MongoDb.Connection conn   = new Nequeo.Data.MongoDb.Connection("nequeompcx64");
            Nequeo.Data.MongoDb.DataAccess access = new Nequeo.Data.MongoDb.DataAccess(conn);
            MongoDatabase database = access.GetDatabase("nequeo");
            MongoCollection <UserModel>    coll     = access.GetCollection <UserModel>(database, "User");
            MongoCollection <User>         collUser = access.GetCollection <User>(database, "User");
            MongoCollection <BsonDocument> collb    = access.GetCollection(database, "User");

            BsonDocument[]          bsonData   = access.FindAll(collb).ToArray();
            BsonDocument            bsonData_1 = bsonData[0];
            IEnumerable <BsonValue> values     = bsonData_1.Values;

            object[] users = access.CreateDynamicModel(bsonData, "User");
            System.Data.DataTable table = access.CreateDataTable(users, "User");

            UserModel[]           data      = access.FindAll(coll, limit: 1, skip: 1).ToArray();
            System.Data.DataTable tableUser = access.CreateDataTable(data, "User");

            User[] User   = access.FindAll(collUser).ToArray();
            long   number = access.Count(coll);

            dataGridView1.DataSource = table;
        }
Пример #4
0
 private void button4_Click(object sender, EventArgs e)
 {
     Nequeo.Data.MongoDb.Connection conn   = new Nequeo.Data.MongoDb.Connection("nequeompc");
     Nequeo.Data.MongoDb.DataAccess access = new Nequeo.Data.MongoDb.DataAccess(conn);
     MongoDatabase database = access.GetDatabase("nequeo");
 }