WCF
Finally on VS 2008 we can easily know that we are running a VS instance pointing to the experimental hive by just looking at the window title. :)
Pablo
For more information about VSCT and the new way of defining VS commands you can check Aaron's posts CTC is dead...Long Live VSCT! (Part 1) and CTC is dead...Long Live VSCT! (Part 2) or mine.
So, lets go to the main topic of this post:
Important: This applies to the VSCT compiler that comes with the VSSDK V4 for VS 2005.
The VSCT compiler can perform multiple tasks. Its main usage is for compiling VSCT command definition files, but on this post I am going to show another useful operation that could be performed with the VSCT compiler:
VSCT decompilation:
You can use the VSCT compiler to decompile an assembly or a cto file and obtain the VSCT command definition file.
One important thing to note is that the output of the VSCT compiler is also .cto file (same as CTC.exe).
Because the outputs are the same, it doesn't matters if the CTO embedded in the assembly was generated with CTC.exe or with VSCT.exe. And the good thing is that you don't need to specify what are you decompiling, all its done automatically by VSCT.exe. This also means that you could do an implicit CTC to VSCT transformation.
Example:
The VSCT.exe is located under %VSSDK_InstallDir%\%Version_Number%\Prerelease\VSCT\
vsct.exe C:\Temp\MyPackage\MyPackage\obj\Debug\MyPackage.cto MyPackage.vsct
or
vsct.exe C:\Temp\MyPackage\MyPackage\bin\Debug\MyPackage.dll MyPackage.vsct
Pablo
The december CTP of Service Factory was released, it includes valuable guidance for building ASMX and WCF services.
This is a list of the main features:
- WCF Support
- WSDL first support
- Versioning
- VBNet support
Get it from here and enjoy it.
Pablo
When creating a WCF Client we have two possibilities:
The well known option is to create a proxy using svcutil.exe, this implies having the proxy class itself and the corresponding changes to the application configuration file.
But we have another option, we could use the ChannelFactory class to construct a channel between the client and the service without the need of a proxy.
Suppose that we have the following contract:
This is the codesnippet for the channel creation on the client:
This has in my opinion a couple of benefits:
- We dont need to generate the proxy class and configure the client.
- In a development enviroment everytime that we add/modify a service contract/data contract/message contract we need to re-generate the proxy for the client. This could save time everytime that we need to run our tests :)
Please check the documentation for more information.
Pablo
If you installed WinFx Feb CTP, you already noticed that there is no intellisense support on the configuration files.
I already reported the bug at product feedback, but meanwhile Juval from Idesign updated the xml for the intellisense support.
Steps:
- Download the xsd file from here.
- Copy the file to C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\. (Backup existing schema)
Michelle (aka Das Blonde) is writing a WCF book, and you take a look at the chapters on her blog.
The current chapters are great a you can get immediate hands-on practice.
Pablo
Check this post by Ed Pinto to see which are the changes that will break existing code.
Pablo
I made some research about this topic and I found this post from Matt Tavis.
Basically we need to define our service contract in the following manner to support WCF and ASMX:
namespace
ServiceContracts
{
[ServiceContract]
[WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1,EmitConformanceClaims=true)]
publicinterfaceIEmployeeManager
{
[OperationContract]
[WebMethod]
Employee getEmployee(int employeeId);
}
}
The System.Web.Services.WebServicesBindingAttribute class is used to specify a binding that describe things like the service location, its namespace, conformance to the WS-I Basic Profile, etc.
In the .NET Framework 2.0, this attribute and the WebMethod attribute may now be applied to interfaces.
So we can have Interface-Based Service Contracts that target ASMX also.
Pablo