标签:style blog color ar sp div art log ad
1.第一种方式 if(partsSalesOrderTypes.GroupBy(entity => new { entity.Name, entity.Code }).Any(array => array.Count() > 1)) { /*违反多字段唯一时,提示信息处理*/ return; } 2.第二种方式 var groupPrice = from price in this.PartsSpecialTreatyPrices group price by new { price.DealerId, //分组字段 price.PartsSalesCategoryId, //分组字段 price.SparePartId //分组字段 } into groups select new { count = groups.Count(), key = groups.Key }; if(groupPrice.Any(group => group.count > 1)) { /*违反多字段唯一时,提示信息处理*/ }
标签:style blog color ar sp div art log ad
原文地址:http://www.cnblogs.com/hornet/p/4060290.html