Beispiel #1
0
        public void InsertSingleRecord <T>(T input)
        {
            string entityType     = "";
            string collectionName = null;

            ReadDBMetadata <T>(out collectionName, out entityType);
            IDbDocument item = (IDbDocument)input;

            item.type = entityType;

            IMongoCollection <dynamic> collection = database.GetCollection <dynamic>(collectionName);

            collection.InsertOne(input);
        }
Beispiel #2
0
        public void InsertMultipleRecords <T>(IList <T> inputList)
        {
            string entityType     = "";
            string collectionName = null;

            ReadDBMetadata <T>(out collectionName, out entityType);

            IMongoCollection <dynamic> collection = database.GetCollection <dynamic>(collectionName);

            for (int index = 0; index < inputList.Count; index++)
            {
                T           param = inputList[index];
                IDbDocument item  = (IDbDocument)param;
                item.type = entityType;
                collection.InsertOne(param);
            }
        }