티스토리 뷰
1. EntityQuery를 이용해서 클라이언트에서 조건을 추가해서 조회하기
//Server side
[Query]
public IQueryable<VisitReservation> GetVisitReservations(int siteid)
{
var results = from kkk in this.ObjectContext.VisitReservations
.Include("Visitors")
.Include("Visitors.Cards")
.Include("VisitorUsers")
.Include("VisitorPermissions")
where kkk.SiteId == siteid
orderby kkk.ReservedOn
select kkk;
return results;
}
//Client side
using System.ServiceModel.DomainServices.Client;
DateTime start = new DateTime(this.StartDate.Year, this.StartDate.Month, this.StartDate.Day, 0, 0, 0);
DateTime end = new DateTime(this.EndDate.Year, this.EndDate.Month, this.EndDate.Day, 23, 59, 59);
var query = from kkk in DomainContext.GetVisitReservationsQuery(this.SiteId)
where kkk.ReservedOn >= start
&& kkk.ReservedOn <= end
&& (kkk.UserId == User.Id || kkk.ApproverId == User.Id)
select kkk;
this.DomainContext.Load(query, LoadBehavior.RefreshCurrent,
lo =>
{
if (lo.HasError == true)
{
lo.MarkErrorAsHandled();
MessageBox.Show(string.Format(StringTable.FailedToLoadData, lo.Error.Message));
return;
}
this.VisitReservations = new ObservableCollection<VisitReservation>(lo.Entities);
this.SearchResult = string.Format("[{0} {1}]", StringTable.SearchResults, this.VisitReservations.Count);
}, null);
'Previous Platforms > WCF RIA Service' 카테고리의 다른 글
| Authentication in Silverlight 5 & SQL CE 4.0 (0) | 2012.02.16 |
|---|---|
| WCF RIA Service host SOAP endpoint (0) | 2012.02.10 |
| Silverlight 5 & WCF RIA Service & SQL CE 4.0 (0) | 2012.02.09 |
| WCF RIA Service 6 (ComboBox Binding) by Silverlight 4 (0) | 2012.01.05 |
| WCF RIA Service 5 (Image Upload by Domain Service) by Silverlight 4 (0) | 2012.01.05 |
- Total
- Today
- Yesterday
- LINQ
- Cross-platform
- windows 11
- MVVM
- visual studio 2019
- #uwp
- Visual Studio 2022
- dotNETconf
- ef core
- .net
- WPF
- uno-platform
- Behavior
- PRISM
- Microsoft
- #Windows Template Studio
- XAML
- Always Encrypted
- Bot Framework
- IOT
- kiosk
- ComboBox
- #MVVM
- C#
- uno platform
- UWP
- .net 5.0
- Build 2016
- Windows 10
- #prism
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |