Bill Gibson's Blog

Thoughts on building SQL Server Data Tools

Yes, you can use copy and paste on the Application Designer

This came up in a discussion with some MVPs the other day – they didn’t realize you can use copy and paste on the design surface.  It’s actually pretty darn useful and worth a few comments.  If you copy and paste an application then we copy the entire application, endpoints and all.  If your copied application has consumer endpoints that are connected, then we assume you want the same configuration of those endpoints on the copy, so the pasted application will also be connected to the same application(s) on the diagram.  It’s easy to reconnect them to something else later if that isn’t what you wanted.  If the application has Web service provider endpoints defined with operations then the operation definitions are copied also.  This is a shallow copy, so you’ll get the operation signatures including the names of the argument types.  This applies whether the application is implemented or not.  You are never copying the implementation (method bodies).

Copying an application with Web service endpoints is a great way to make substitutable services – the contracts will be the same, so subject to your implementations, the services can be used by the same clients.  This can be useful for testing – copying an application is great way to quickly create a test stub application for a service or a test client application.  And you needn’t be concerned that these test applications will show up in your deployment definition, because you will create explicit system definitions that will exclude these test applications, (I’ll talk more about the System Designer and using explicit system definitions in other posts). 

You can also copy endpoints alone – the endpoints must all be on the same application and you can only paste them onto an application that supports that kind of endpoint.  Again, the interesting case is copying Web service endpoints – useful for creating substitutable services or just getting a jump start on defining a new Web service.  In another post I’ll compare using copy and paste for creating endpoints with the Create Web Service Endpoint from WSDL feature.  

You can also copy/paste operations inside the Web service details window – again this is a shallow copy which doesn’t copy the underlying types.

And in all cases above you can copy and paste between IDE instances so you can copy from one application diagram to another.

Finally, copy/paste preserves all the properties and settings/constraints (where it makes sense).  For example, if you have defined the WSDL service and binding names and namespaces on your endpoints then these are preserved – that’s way better than re-entering the attributes in code.  Although do remember to change these if the service you create isn’t intended to be substitutable.