Thursday, April 26, 2007

Regex note to self - taking service contracts from the config to ...

For the config file with: <service behaviorConfiguration="DebugServiceBehavior" name="DQV.Apps.Client.Setup.WebServices.ServiceImplementation.CommonCodeService"> <endpoint binding="basicHttpBinding" bindingConfiguration="legacyBinding" bindingNamespace="http://DQV.Apps.Client.Setup.WebServices.ServiceContracts/2007/03" contract="DQV.Apps.Client.Setup.WebServices.ServiceContracts.ICommonCodeService" /> </service> <service behaviorConfiguration="DebugServiceBehavior" name="DQV.Apps.Client.Setup.WebServices.ServiceImplementation.CompanyService"> <endpoint binding="basicHttpBinding" bindingConfiguration="legacyBinding" bindingNamespace="http://DQV.Apps.Client.Setup.WebServices.ServiceContracts/2007/03" contract="DQV.Apps.Client.Setup.WebServices.ServiceContracts.ICompanyService" /> <!--<endpoint contract="IMetadataExchange" binding="basicHttpBinding" bindingConfiguration="legacyBinding" bindingConfiguration="MexBinding" address="mex" />--> </service> Regex: (<service.*?name=")(.*?)(".*?</service>) Replace sample: Contracts.Add($2); Output: Contracts.Add(DQV.Apps.Client.Setup.WebServices.ServiceImplementation.CommonCodeService); Contracts.Add(DQV.Apps.Client.Setup.WebServices.ServiceImplementation.CompanyService);

No comments: