1
我有一個使用EF模型運行RIA服務的C#.NET Silverlight 3.0客戶端。我試圖在客戶端上建立一個高級搜索系統,以便用戶可以說,我希望field(property)「Foo1」具有值「Bar1」等。如何通過RIA服務從客戶端傳遞動態搜索參數?
我想使用類似於this one的靈活動態方法。問題是我無法將IQueryable作爲ServiceOperation參數或域服務參數傳遞。 I.E.這是行不通的:
[ServiceOperation()]
public int GetFooCount(string category, IQueryable<Foo> search)
{
int fooCount;
if (search != null)
{
IQueryable<Foo> filteredFooSet = this.Context.FooSet.Intersect(search);
fooCount = (from foo in filteredFooSet
where foo.Category == category
select foo).Count();
}
else
{
fooCount = (from foo in this.Context.ContactSet
where foo.Category == category
select foo).Count();
}
return fooCount;
}
任何人都可以提出一種方法來獲得這種方法的工作或替代(更好)的方法?目標是一個靈活的搜索控件,可以應用於比任何單個特定實體類型更多的應用程序。
這工作!非常感謝! – 2009-11-11 23:03:15