TypeScript Service Façade Generator

This project provides a tool to ensure web application front-ends and back-ends can be tied up seamlessly, where changes to the server-side .NET code are reflected in the client-side JavaScript code.

UPDATE (2015-03-09): TSFacade 0.1a is now available for download. Click the download link on the right hand side of this page. Documentation will be published shortly.

UPDATE (2015-02-15): the project is now deployed as a Visual Studio package containing everything you need to create a service façade in a few clicks. An alpha release will be available very soon - watch this space!

TSFacade in action

A bit of background

One of the major issues I have found when creating responsive, JavaScript-based web applications with a .NET back end has been the requirement to create a server-side object model in C# and a completely separate but compatible JavaScript object model to be delivered to the client browser. Server-side changes to web service names, service method parameters, parameter types and return types must all be reflected in the JavaScript immediately. If they are not, however, issues are not discovered until runtime.

TypeScript is, without doubt, the best thing since sliced bread. It does what JavaScript has been missing since its inception:
  • Provides design-time type checking, even through nested callbacks
  • Allows simple namespacing of your JavaScript code
  • Abstracts all of the mess that needs writing to emulate an object-orientated language
  • Allows intuitive control over the 'this' keyword
  • Through DefinitelyTyped, provides neat integration with existing 3rd party JavaScript libraries such as jQuery, etc.
  • Provides language constructs such as interfaces which are familiar features in C# and other OO languages.
  • Produces js.map files to allow TypeScript code to be debugged in VS while the corresponding JavaScript runs in the browser.

TSFacade produces a TypeScript façade for your ASP.NET web services. It will recreate in TypeScript any serialisable service method parameter or return types and namespace them correctly, as well as exposing your ASP.NET web services as classes with static methods, all with matching names.

To the developer this gives the impression that your server- and client-side code are one and the same. When integrated into a build process, changes to the server-side code are reflected in the client-side code, allowing TypeScript to do its type checking; discrepancies between server- and client-side code are thus picked up at design time rather than run time, and productivity skyrockets! Check out TSFacade in action to get an idea of how it looks in Visual Studio.

I'd love for other people to get involved in this project, so if you're an avid TypeScript fan with some mad C# skills, and especially if you are experienced with development of add-ins for Visual Studio, please get in touch!

Last edited Mar 9, 2015 at 2:10 AM by samdv, version 7