Beispiel #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");
        }
Beispiel #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);
        }