Perform text searches using operands and operators together. When no operator is supplied between words ‘AND’ is default.
1: _entities = new NorthwindEntities();
2: var customers = _entities.Search<Customer>("john and aria michael OR yang not steel MEXICO");
Additionally to working with operators and operands, you may use phrases by providing double quotes “around sets of words”.
1: customers = _entities.Search<Customer>(@"owner AND Ana Sales ""Aria Cruz""");
Provide a Func<T, bool> delegate to reduce the size of the search.
1: customers = _entities.Search<Customer>("john michael OR yang",
2: (Customer c) => c.ContactTitle == "owner");
Provide a Func<Type, bool> delegate to specify the types on the EF object being searched. Supply default(Func<Type,bool>) as null.
1: customers = _entities.Search<Customer>(@"owner AND Ana Sales ""Aria Cruz""",
2: (Customer c) => c.Address != string.Empty,
3: (Type t) => t == typeof(string) || t == typeof(int));
Provide a Func<PropertyInfo, bool> delegate to access properties of Entity Framework object being searched. Supply default(Func<PropertyInfo,bool>) as null.
1: customers = _entities.Search<Customer>(@"owner AND Ana Sales ""Aria Cruz""", 2: (Customer c) => c.Address != string.Empty, 3: (PropertyInfo p) => p.Name == “ContactName” || p.Name == “ContactTitle”);
Do an advanced search using SearchEF and standard LINQ implementation models. The Search<T> method returns a List<ISearchResult<T>> where T is the EntityObject type.
1: var orders = (from customer in _entities.Search<Customer>(@"owner AND Ana Sales ""Aria Cruz""",
2: (Customer c) => c.Address != string.Empty,
3: (Type t) => t == typeof(string) || t == typeof(int))
4: join order in _entities.Search<Order>("mexico NOT canada")
5: on customer.Value.CustomerID equals order.Value.CustomerID
6: select order).ToList();