Christian shows how to generate the c# service contract code giving wsdl, xml schema, and policies files. If you already have an Indigo service running and you need to generate from your program the contract code, you can use the same Christian's code and simply use System.ServiceModel.MetadataResolver class in order to get all the service metadata information:
MetadataResolver resolver = new MetadataResolver(new EndpointAddress(uri));
// I use HTTP/Get to get from the service its metadata
ServiceEndpointCollection endpoints = resolver.RetrieveEndpointsUsingHttpGet();
// Christian's code....
ServiceContractGenerator generator = new ServiceContractGenerator();
Collection<ContractDescription> contracts = resolver.WsdlImporter.ImportAllContracts();
foreach (ContractDescription contract in contracts)
{
generator.GenerateServiceContractType(contract);
}
using (StreamWriter writer = new StreamWriter(File.Create("Contracts.cs")))
{
new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(
generator.TargetCompileUnit, writer,
new System.CodeDom.Compiler.CodeGeneratorOptions());
}
During the past week I played a little bit with SQL Server 2005 Integration Services in order to understand some basic concepts. As usually I do, I start with some 'real' cases I have in other contexts and try to understand how to do with the new technology. The problem was pretty simple, normalize a denormalized flat file. Consider a flat file containing the following data (content is fictious):
Date;USD;EUR;JPY
12/12/2004;1.2332;1;23.32
I have to create another flat file (just as sample) like following:
date;Currency;Price
12/12/2004;USD;1.2332
12/12/2004;EUR;1
12/12/2004;JPY;23.32
So, I created one flat file source and one flat file destination with the structire as above. Then I placed an Unpivot Transformation component linked to the flat file components with the following settings:
- Input Column: USD, EUR, JPY, ... (all columns except Date)
- Data Column: Price (all the same)
- Pivot Value as Input Columns
- Pivot value column name: Currency
Run the package and everything works fine. I have to thank Ashvini Sharma for his valuable help.