Search code examples
wcfwcf-ria-services

Use RIA services domain service without Query method


I created a LoggerDomainService witch look like this :

 [EnableClientAccess()]
public class LoggerDomainService : DomainService
{

    public void info()
    {
        // todo
    }
}

And after building the server side the LoggerDomainContext did not created. I've noticed that in order to make it work I need to declare inside the class at least on method with the [Query] attribute. Is there better way to solver the problem, should I inherit from something else then DomainService ?


Solution

  • You are correct about the [Query] attribute. With your logging service, I recommend using [Invoke]:

    [EnableClientAccess()]
    public class LoggerDomainService : DomainService
    {
        [Invoke]
        public void info()
        {
            // todo
        }
    }
    

    Then you will find the context created.