Is there a standards-sanctioned XML format for describing entity queries?
Background: I plan to build a library for writing queries over WCF services.
On the client I want to be able to write (C#):
var customers = from c in service.Customers
where c.Name.StartsWith("P")
order by c.Name
select c;
I will use a custom serializer to turn the LINQ query into an XML format to send as part of the SOAP body to the server. Maybe it would look something like this:
<query>
<fetch entity="Customer">
<all-attributes />
<filter type="and">
<condition attribute="Name" operator="starts-with" value="P" />
</filter>
<order-by attribute="Name" />
</fetch>
</query>
On the server side, the operation would look something like this:
public ResultSet Query(Query query)
{
using (var dataContext = new AdventureWorksDataContext())
{
var expression = query.ToExpressionTree();
var sqlQuery = dataContext.CreateQuery(expression);
return ResultSet.From(sqlQuery);
}
}
Since the query is just XML, my hope is other clients will also be able to use it easily enough.
My question is, is there already an XML schema that describes queries like this?
The one that inspired me was Microsoft CRM's FetchXML:
http://msdn.microsoft.com/en-us/library/ms936573.aspx
Have any of the web services standards bodies defined a schema for queries over web services? Any other suggestions?