This project is read-only.

Support for bound actions referencing derived resource types


In the current framework a runtime type-mismatch exception occurs when invoking a bound action using a reference to an instance of a derived type.

For example, a Rate action bound to a Movie cannot be invoked on instances of derived types such as ActionMovie or MysteryMovie in the Movies resource set.

Parameter type matching should be enhanced to accept a reference to a derived type as a reference to a base type (type covariance).


KPiette wrote Aug 27, 2012 at 5:17 AM

To clarify - The "type covariance" I'm referring to would apply to the reference type created for the indexed member of the Movies resource set - the IQueryable<out Movie>.

IQueryable covariance is not required to make this work, and would likely be more complicated than simply accepting instance types derived from base types of service action parameters during marshalling. The strict parameter type equivalence appears to lie in ObjectContextServiceProvider.GetResource(IQueryable query, string fullTypeName).