티스토리 뷰
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
- XAML
- Build 2016
- ef core
- .net
- uno platform
- C#
- UWP
- MVVM
- Always Encrypted
- #prism
- ComboBox
- #uwp
- IOT
- .net 5.0
- dotNETconf
- Bot Framework
- windows 11
- visual studio 2019
- #Windows Template Studio
- PRISM
- Behavior
- Cross-platform
- Visual Studio 2022
- kiosk
- Windows 10
- WPF
- LINQ
- Microsoft
- #MVVM
- uno-platform
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 | 31 |