2 November, 2009
3 Comments
0 categories
If you want to use datedif to filter on a date, you can use code like:
public EntityCollection<Customers> GetCustomers(DateTime creationDate) { EntityCollection<AfhaalopdrachtEntity> result = new EntityCollection<AfhaalopdrachtEntity>(); // Filter IRelationPredicateBucket filter = new RelationPredicateBucket(); IPredicate customerCreateDateFilter = new EntityField2("CreateCustomerDiff", new DbFunctionCall("DATEDIFF(day, {0}, {1})", new object[] { CustomerFields.CreationDate, creationDate})) == 0; filter.PredicateExpression.Add(customerCreateDateFilter ); // Fetch (get the data) using (DataAccessAdapter da = ConnectionHelper.GetAdapter(Source.Pegaso, Global.Logger)) { da.FetchEntityCollection(result, filter); } return result; }
Tags: LLBLGen
Thanks, this is just what I needed!
Thanks this was really handy… One question?
What’s a AfhaalopdrachtEntity 🙂
Unfortunately some data models are still in dutch.
I try to keep dutch out of my code and data models, but some times it creeps in 😉