SouthWind.Product.SingleOrDefault C# (CSharp) Method

SingleOrDefault() public static method

public static SingleOrDefault ( bool>.Expression expression ) : Product
expression bool>.Expression
return Product
        public static Product SingleOrDefault(Expression<Func<Product, bool>> expression) {

            var repo = GetRepo();
            var results=repo.Find(expression);
            Product single=null;
            if(results.Count() > 0){
                single=results.ToList()[0];
                single.OnLoaded();
                single.SetIsLoaded(true);
                single.SetIsNew(false);
            }

            return single;
        }      
        

Same methods

Product::SingleOrDefault ( bool>.Expression expression, string connectionString, string providerName ) : Product