Search code examples
wcf-data-services

Replacement for IExpandProvider


I'm trying to create an OData WCF service using NHibernate and I'd like to use $expand in queries. I found an interface IExpandProvider, which I guess, is (was) exactly for this purpose. But it says The IExpandProvider interface is deprecated. What's the current way to implement expand?


Solution

  • Starting with V2 the IExpandProvider is deprecated because it can't support the new query options, like $select. The "new" way is to implement IQueryable. All the query options are translated into LINQ expression trees. If you want a bit more detail on how that is done see this series: http://blogs.msdn.com/b/vitek/archive/2010/02/25/data-services-expressions-part-1-intro.aspx. The part talking about $expand is here: http://blogs.msdn.com/b/vitek/archive/2010/07/15/data-services-expressions-part-9-expansions.aspx