Skip to main content
Home Forums Silverlight Programming WCF RIA Services Overide method Invoke in LinqToEntitiesDomainService
5 replies. Latest Post by Jay_Harlow on November 10, 2009.
(0)
xelandr
Member
3 points
5 Posts
11-08-2009 9:22 AM |
I trying to override method Invoke in LinqToEntitiesDomainService, with code:
public override object Invoke(System.Web.DomainServices.DomainOperationEntry serviceOperation, object[] parameters, System.Collections.Generic.ICollection<System.Web.Ria.Data.OperationError> validationErrors) { using (System.Web.Hosting.HostingEnvironment.Impersonate()) { return base.Invoke(serviceOperation, parameters, validationErrors); } }
But when I build, I get the following error:
Error 146 Parameter 'serviceOperation' of domain operation entry 'Invoke' must be one of the predefined serializable types.
What wrong in my code?
bryant
Star
9937 points
1,629 Posts
11-09-2009 5:07 PM |
Why are you overriding the invoke method?
Jay_Harlow
48 points
9 Posts
11-09-2009 5:39 PM |
By default RIA attempts to add the method as a Service Operation to the generated service, you need to an IgnoreOperation attribute to the method:
{
Hope this helps
Jay
11-10-2009 3:20 AM |
Thanks Jay, but not worked. Well compiled, but method not calling.
11-10-2009 3:22 AM |
to set impersonation, for all underlying calls to database
11-10-2009 12:16 PM |
What are you doing that you are expecting it to be called?
It should be implicitly called when you perform a Service Operation in RIA. (not to be confused with a Query operation or Submit operation).
Query operations implicitly call the overridable DomainService.Query method, while Submit operations implicitly call the overridable DomainService.Submit method.
I override all three in my domain services to provide tracing & exception logging support. (I actually override all the DomainService/LinqToEntitiesDomainService overridable methods which is probably overkill for tracing... ;-))