Question

This is more a cosmetic issue, rather than an actual "problem". I've got a solution in which I am converting a lot of PageMethods into WebService calls instead. Some of the PageMethods created a page overhead of several hundred kilobytes, so I thought I'd extract them into their own WebServices, thus reducing the page overhead and enabling client side caching of the JavaScript proxies.

However, the project is structured with a lot of namespaces eg. CompanyName.Website.Services.MyService.ServiceMethod

This translates literally into JavaScript in the same namespaces. In most cases I find this quite nice, but when I have around 20 methods in a service, it becomes quite tedious, always writing the same namespaces.

I did a bit of research, and found that I could write my own alias like so

var MyAlias = function() { CompanyName.Website.Service.MyService; }

Doing that, however, makes Visual Studio 2010 unable to provide intellisense. It works as expected, but I don't get to use the sweet, sweet intellisense I've come to love so much :)

So, my question is this: Are there any ways I can provide an alias for the generated proxy (like I can with custom types)?

I've tried using the attribute [System.Web.Script.Services.GenerateScriptType(typeof(MyService), ScriptTypeId = "MyServiceAlias")] It does create some sort of alias, but I couldn't really figure out what impact it would have. Furthermore I don't think that's supposed to be used for static types like the WebService class is.

My requirements are, that I can shorten the generated proxy namespaces while keeping the original in the WebServices, but still get to use intellisense.

Thanks in advance...

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top