Closed HeikoAdams closed 4 years ago
Let me see if I can address these ...
Let's start with Filter, it is still fully supported, here's an example. The key is you need to have a using statement for System.Linq
EmployeesCollection coll = new EmployeesCollection();
if (coll.LoadAll())
{
// Filter on FirstName containing an "a"
coll.Filter = coll.AsQueryable().Where(d => d.FirstName.Contains("a"));
foreach (Employees employee in coll)
{
// Each employee's FirstName has an 'a' in
}
// Clear the filter
coll.Filter = null;
foreach (Employees employee in coll)
{
// All employees are now back in the list
}
}
This should still be present, is this what you are looking for?
Employees emp = new Employees();
if(emp.es.HasData)
{
}
This should also still work fine ... If you are calling AddNew() on a single entity that is no longer necessary, I would suspect you were on an early version of EntitySpaces as that became unnecessary very early on.
EmployeesCollection coll = new EmployeesCollection();
Employees emp = coll.AddNew();
That method is gone, it is recommended that you just new another Query object. To be honest, it's faster to create a new one rather than us trying to clean-up all the internal objects created in a query in order to reuse it.
I looked for that, even in the old EntitySpaces source posted up there, I don't see it. Of course you can use OrderBy() when you query data. However, after it is loaded It is recommended that you use Filter for that, see ..
// Sorting by the Employee’s first name
coll.Filter = coll.AsQueryable().OrderByDescending(d => d.FirstName);
// Filtering for all Empoyees missing their FirstName
coll.Filter = coll.AsQueryable().Where(d => d.FirstName == null);
// Both Filtering and Sorting
coll.Filter = coll.AsQueryable().Where(d => d.FirstName == null).OrderByDescending(d => d.LastName);
I hope this answers most of your questions, feel free to ask away if not ...
Hi, thanks for your answer. QueryReset has been remove from my code and using .es.HasData did the job for HasData - previously it was just .HasData
Am I right that I've to find a way to convert my string filter- and sort-expressions to linq to solve that issue?
Ya, sorry on the Filter thing. It does offer a lot more power now though because you can do basically anything through the LINQ syntax to sort or filter a collection after it's loaded.
Marking the old filter-property obsolete and making the sort-property obsolete too and triggering the filter-property would have been a better way. But now its as it is. ¯_(ツ)_/¯
Hello, I'm currently porting our application to the current version of entity spaces and running in some problems:
These are showstopper for us!