Originally posted by tj62
I don't know if this is the right place for my question. If not
please advice me what is thr right forum for it.
|
Technically this is a LINQ question rather than a DevForce question, and you might get better answers on a LINQ forum somewhere. But you can always ask. We (IdeaBlade staff) have to give priority to the DevForce questions, but sometimes we enjoy practicing our LINQ, too; and there are, of course, lots of other LINQ users on this forum who may help.
I believe the problem is that your query is ordering the entities -- whatever their type name -- coming out of
EntPointGroupAccessSet rather than the Customers you ultimately project out.
I created the following attempted analog of your query, targetting the NorthwindIB database that we ship with DevForce:
var customerQ = (from od in _mgr.OrderDetails
where od.UnitPrice > 50
orderby od.Order.Customer.CompanyName
select od.Order.Customer).Distinct();
Like you, I get Customers
not sorted by CompanyName.
But if I change the query to the following, I get the Customers sorted as desired:
var customerQ = (from od in _mgr.OrderDetails
where od.UnitPrice > 50
select od.Order.Customer).Distinct()
.OrderBy(c => c.CompanyName);
The corresponding query with your types would look like this:
var customerQ = (from c in _manager.EntPointGroupAccessSet
where c.p_userID == "jhon"
select c.p_pointGroup.p_customer).Distinct()
.OrderBy(cust=>cust.p_name);