1
votes

I have the following Ria Service define:

namespace SilverlightTest.Web
{
    [EnableClientAccess()]
    public class ContactService : LinqToEntitiesDomainService<AdventureWorksEntities>
    {
        public IQueryable<Contact> GetContactSearch(string lastName)
        {
            ContactRepository rep = new ContactRepository();
            return rep.SearchByLastName(lastName);
        }
    }
}

When I compile the solution, my SilverlightTest project does create the SilverlightTest.Web.g.cs file and the appropriate Context objects are created when I look at it. However, when I attempt to import the SilverlightTest.Web namespace to access the Data Context class for the above service, it says it cannot find the Web namespace.

The only difference I can see between what I'm doing and many examples that are out there on the web is that my AdventureWorksEntities data context is located in a separate business object dll. I tried to query the context directly instead of using the Repository Pattern I'm attempting to do and it also isn't work working.

Any ideas? Is it possible to have Ria Services access a separate DLL handling data access or does it HAVE to be in the same project?

2

2 Answers

2
votes

I've been able to put the Ria service in a separate project before, although I do remember having issues. Not sure exactly what it was, but I would check two things: your references and your web.config (in the hosting website). When you add a ria service to a web project it does some things behind the scenes that wire everything up correctly.

Could try adding a service to your web project temporarily and see what it adds.

0
votes

It seems that Resharper does not recognize the .gs files and their name spaces. If you disable R# or just code without intelisense it works.