Пример #1
0
        /// <summary>
        /// MongoDb向指定集合插入一条记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="collectionName">存储集合名</param>
        /// <param name="model">存储数据模型</param>
        /// <returns></returns>
        public static bool Insert <T>(string collectionName, T model) where T : IEntity <string>
        {
            var result = MongoDbHepler.Insert(collectionName, model);

            return(result.Ok);
        }
Пример #2
0
        /// <summary>
        /// 插入一条记录
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <param name="collectionName">集合名称</param>
        /// <param name="model">数据对象</param>
        public static bool Insert <T>(string collectionName, T model)
        {
            var result = MongoDbHepler.Insert(nosqlConnectionString, nosqlDbName, collectionName, new MongoModel <T>(model));

            return(result.Ok);
        }