开发者

WCF: Datasource interface with LINQ-expressions?

Im trying to create a WCF-service to hold generic data for a bunch of different applications. Something like this:

[ServiceContract]
public interface IDataService
{
    [OperationContract]
    IEnumerable<IDataObject> Retrive(string query);
}

[DataContract]
public interface IDataObject
{
}

Now what I really would want is some way of using LINQ instead of a string-query. I mean like this:

var set = ds.Retrieve().OfType<INote>().OrderBy(n =>开发者_如何学Go n.Created).Take(50);

Is this possible somehow?


It sounds like using WCF Data Services would be the way to go.

You could also define your own IQueryProvider and serialize the LINQ expression tree if you need truly complex LINQ support. See:

http://msdn.microsoft.com/en-us/library/bb546158.aspx

http://interlinq.codeplex.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜