public void Import(IUserInterfaceHandlerIO io)
        {
            this.mongoContext.Connect("furnitures",  io);
            XDocument xmlDoc = XDocument.Load(documentPath);
            var descendants = xmlDoc.Descendants("room");

            Console.WriteLine("Seeding materials quantity from XML to SQL");

            foreach (var node in descendants)
            {
                var item = new MongoModels.Room(node.Element("name").Value.ToString());
                this.rooms.Add(item);
                Console.Write(".");
            }

            var rooms = this.mongoContext.Database.GetCollection<MongoModels.Room>("rooms");
            rooms.InsertBatch(this.rooms);
        }
示例#2
0
        public void Import(IUserInterfaceHandlerIO io)
        {
            this.mongoContext.Connect("furnitures", io);
            XDocument xmlDoc      = XDocument.Load(documentPath);
            var       descendants = xmlDoc.Descendants("room");

            Console.WriteLine("Seeding materials quantity from XML to SQL");

            foreach (var node in descendants)
            {
                var item = new MongoModels.Room(node.Element("name").Value.ToString());
                this.rooms.Add(item);
                Console.Write(".");
            }

            var rooms = this.mongoContext.Database.GetCollection <MongoModels.Room>("rooms");

            rooms.InsertBatch(this.rooms);
        }