In the RIA domain service, I added some useful features. For example, we have ...
public virtual CmsDealer GetCmsDealerById(string id) { return this.Context.CmsDealerSet .Include("CmsItemState") .FirstOrDefault(p => p.Id == id); }
Now this function has its problems if the identifier is not real, but now it allows you to use the table. The important thing is that the function is compiled and executed.
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); } }
Throws 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 fact is that I can understand that the (string id) parameter is not suitable for EF, but why is this normal in one case and not in another?
Entrance is welcome :)
source share