1

私は次のコードを試しています:

public IList<Brand> GetMobileDeviceBrands()
{
     var dataContext = dataContextFactory.CreateContext();

     var brands = (from b in dataContext.Brands
                   join d in dataContext.Devices on b.ID equals d.BrandID
                   where d.DeviceTypeID != 1
                   select b).OrderBy(b => b.Name).Distinct().ToList();

     return brands;         // not ordered by Name here
}

しかし、期待どおりに注文された結果が得られません。

orderByコントローラーに次のように記述した場合:

var Brands = devicesListService.GetMobileDeviceBrands().OrderBy(b => b.Name).ToList();

うまくいっている。何が問題なのかわかりません。

4

1 に答える 1