private void LoadDistinctValuesAsync() { NorthwindDomainContext context = new NorthwindDomainContext(); EntityQuery<DistinctValue> countriesQuery = context.GetDistinctValuesQuery("Country"); context.Load<DistinctValue>(countriesQuery , LoadBehavior.RefreshCurrent , this.OnDistinctValuesLoaded , this.countries); EntityQuery<DistinctValue> citiesQuery = context.GetDistinctValuesQuery("City"); context.Load<DistinctValue>(citiesQuery , LoadBehavior.RefreshCurrent , this.OnDistinctValuesLoaded , this.cities); EntityQuery<DistinctValue> contactTitlesQuery = context.GetDistinctValuesQuery("ContactTitle"); context.Load<DistinctValue>(contactTitlesQuery , LoadBehavior.RefreshCurrent , this.OnDistinctValuesLoaded , this.contactTitles); }
public CustomersViewModel() { NorthwindDomainContext context = new NorthwindDomainContext(); EntityQuery<DistinctValue> contactTitlesQuery = context.GetDistinctValuesQuery("ContactTitle"); context.Load<DistinctValue>(contactTitlesQuery , LoadBehavior.RefreshCurrent , this.OnDistinctContactTitlesLoaded , this.contactTitles); EntityQuery<Customer> getCustomersQuery = context.GetCustomersQuery(); this.view = new QueryableDomainServiceCollectionView<Customer>(context, getCustomersQuery); this.view.PageSize = 10; this.view.AutoLoad = true; this.view.PropertyChanged += this.OnViewPropertyChanged; this.view.LoadedData += this.OnViewLoadedData; this.loadCommand = new DelegateCommand(this.ExecuteLoadCommand, this.LoadCommandCanExecute); this.countrySortDescriptor = new SortDescriptor() { Member = "Country" }; this.citySortDescriptor = new SortDescriptor() { Member = "City" }; this.contactTitles = new RadObservableCollection<string>(); this.contactTitles.Add(CustomersViewModel.ClearSelectionString); this.contactTitleFilterDescriptor = new FilterDescriptor("ContactTitle", FilterOperator.IsEqualTo, FilterDescriptor.UnsetValue); this.view.FilterDescriptors.Add(this.contactTitleFilterDescriptor); }