日期:2014-05-20  浏览次数:21243 次

LINQ去重
using (var ctx = new ReadModel.ReadEntities())
            {
                var pwList = new List<ReadModel.product_whole>();
                try
                {
                    pwList =
                        ctx.product_whole.Where(
                            p =>
                            (p.p_code != null && p.p_code.IndexOf(strKeyWords) > -1) ||
                            (p.p_name != null && p.p_name.IndexOf(strKeyWords) > -1) ||
                            (p.commonName != null && p.commonName.IndexOf(strKeyWords) > -1) ||
                            (p.enterprise != null && p.enterprise.IndexOf(strKeyWords) > -1) ||
                            (p.brand != null && p.brand.IndexOf(strKeyWords) > -1)|| 
                            (p.keywords != null && p.keywords.IndexOf(strKeyWords) > -1) ||
                            (p.spell != null && p.spell.IndexOf(strKeyWords) > -1) ||
                            (p.spec != null && p.spec.IndexOf(strKeyWords) > -1) ||
                            (p.type_name_tree != null && p.type_name_tree.IndexOf(strKeyWords) > -1) ||
                            (p.manufacturer_brand != null && p.manufacturer_brand.IndexOf(strKeyWords) > -1) ||
                            (p.attr_value != null && p.attr_value.IndexOf(strKeyWords) > -1) ||