In a RIA Domain service I have added some utility functions. For instance we have...
public virtual CmsDealer GetCmsDealerById(string id)
{
return this.Context.CmsDealerSet
.Include("CmsItemState")
.FirstOrDefault(p => p.Id == id);
}
Now that function has it's own issues if the id is nonexistant, but lets table that for now. The important thing is that function compiles and executes.
However a similar function...
public virtual void DeleteCmsDealerById(string id)
{
var dealer = this.Context.CmsDealerSet
.FirstOrDefault(d => d.Id == id);
if (dealer != null)
{
DeleteCmsDealer(dealer);
}
}
Tosses a compile time error.
*Parameter 'id' of domain method 'DeleteCmsDealerById' must be an entity type exposed by the DomainService, either directly via a query operation, or indirectly via an included association.*
The thing is, I can understand that the (string id) param is not accewptable to EF, but why is it OK in one case and not another?
Input welcome :)