Ask a questionAsk a question
 

AnswerService reference namespace appends to default for project

  • Tuesday, October 07, 2008 1:40 PMbabblefish Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am using Add Service Reference to create proxy entity classes in my Silverlight client which I will use to access my ADO.NET data service. The problem is that when I specify the namespace for my service reference, the tool appends my namespace name to the default namespace of my project. Is there a way to have the tool create the proxy classes in the exact namespace I specify (i.e. don't append to default namespace)?

     

    This issue is occurring with the RC0 client.

     

    Thanks

    Rob

     

Answers

  • Friday, October 10, 2008 6:52 PMPratik Patel - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Can't you clear the default namespace of the project? I think for VB, the types take into account the namespace of the project and to make it consistent, we have done at for the service. If you don't want the default namespace to be taken into account, you can remove it from the project settings and then you should get the exact namespace that you wanted.

     

    Thanks

    Pratik

     

All Replies

  • Friday, October 10, 2008 6:52 PMPratik Patel - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Can't you clear the default namespace of the project? I think for VB, the types take into account the namespace of the project and to make it consistent, we have done at for the service. If you don't want the default namespace to be taken into account, you can remove it from the project settings and then you should get the exact namespace that you wanted.

     

    Thanks

    Pratik

     

  • Friday, October 10, 2008 7:01 PMbabblefish Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I don't know what I was thinking, but I never tried clearing out the default namespace of the project. That makes sense.

     

     

     

  • Wednesday, May 13, 2009 9:42 PMNilay Patel Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Were you able to clear default namespace? How did you resolve this problem?

  • Tuesday, October 27, 2009 12:18 AMSteveHobbs Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry to resurrect an old thread, but I'm experiencing this problem now. I've created ADO.Net Data Services before with VS2008 which generates fine, but now with VS2010 Beta 2 I'm getting the problem described above.

    In my project I have two projects; TaskManager.Client (Silverlight client) and TaskManager.Host (Asp.Net web application project). Host contains the models in the namespace TaskManager.Host.Models, and the service is exposed in TaskManager.Host.Services.

    If I try and add a service reference in the Client project, I put in the desired namespace ('TaskService' for arguments sake) and the namespace which is generated for the models winds up being "TaskManager.Client.TaskService.TaskManager.Host.Models". As you can see the entity namespace from the host is being appended to the client namespace, and is somewhat undesirable.

    I have another project which uses a very similar setup (Silverlight client project, web application host) but was created in VS2008 and has no such namespace problems. There isn't much to configure in the way of namespaces anyway so I can only assume there is a difference in the generator utility which generates this code for me between VS2008 and VS2010.

    As per the suggestion above, this is a C# project and so the default namespace cannot be removed (I like that feature anyway and I would have removed it only as a last resort).

    Any other thoughts/suggestions?

    Thanks in advance
  • Thursday, October 29, 2009 4:03 PMPratik Patel - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    This is a known issue with VS2010 beta2. We have fixed this in the current builds to match the behaviour with VS 2008. So the workaround for now would be to change the namespace in the generated file, after doing add service reference (pretty bad), but that's the only work-around i can think at this moment.

    Hope this helps.
    Thanks
    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Thursday, October 29, 2009 8:56 PMSteveHobbs Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Many thanks for the reply, and glad to hear that it's already sorted :-) I can live with the workaround for now.