/// <summary> /// 批量插入记录 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="collectionName">集合名称</param> /// <param name="model">数据对象</param> public static IEnumerable <bool> InsertBatch <T>(string collectionName, IEnumerable <T> model) where T : IEntity <string> { var result = MongoDbHepler.InsertBatch(nosqlConnectionString, nosqlDbName, collectionName, model); return(result.Select(u => u.Ok)); }
/// <summary> /// 批量插入记录 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="collectionName">集合名称</param> /// <param name="model">数据对象</param> public static IEnumerable <bool> InsertBatch <T>(string collectionName, IEnumerable <T> model) { var result = MongoDbHepler.InsertBatch(nosqlConnectionString, nosqlDbName, collectionName, model.Select(u => new MongoModel <T>(u))); return(result.Select(u => u.Ok)); }