Skip to main content

Microsoft Silverlight

Answered Question Overide method Invoke in LinqToEntitiesDomainServiceRSS Feed

(0)

xelandr
xelandr

Member

Member

3 points

5 Posts

Overide method Invoke in LinqToEntitiesDomainService

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
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Re: Overide method Invoke in LinqToEntitiesDomainService

Why are you overriding the invoke method?

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Jay_Harlow
Jay_Harlow

Member

Member

48 points

9 Posts

Answered Question

Re: Overide method Invoke in LinqToEntitiesDomainService

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:

 [IgnoreOperation]public override object Invoke(DomainOperationEntry serviceOperation, object[] parameters, ICollection<OperationError> validationErrors)

{

Hope this helps

Jay

xelandr
xelandr

Member

Member

3 points

5 Posts

Re: Re: Overide method Invoke in LinqToEntitiesDomainService

Thanks Jay, but not worked.  Well compiled, but method not calling.

xelandr
xelandr

Member

Member

3 points

5 Posts

Re: Re: Overide method Invoke in LinqToEntitiesDomainService

bryant

to set impersonation, for all underlying calls to database

Jay_Harlow
Jay_Harlow

Member

Member

48 points

9 Posts

Answered Question

Re: Re: Overide method Invoke in LinqToEntitiesDomainService

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... ;-))

Hope this helps

Jay

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities