WCF Configuration
Generator
The following table of contents provides an outline of the documentation for this generator.
1. Overview
This generator allows creating Windows Communication Foundation (WCF) server-side or client-side configuration files for
all services that are generated from the object model. It creates endpoints for each service contract based on the global
configuration specified in the model. If the configuration file specified in the output path already exists then it will
be updated to add the new endpoints as necessary, which makes the generator re-runnable.
The generator takes all services defined in the model as the input, which translates to any objects that have operations
defined on them, or on their subobjects, as shown below.
1.2 Generator outputs
The generator adds endpoint configurations for each service to the specified client-side or server-side configuration file.
For server-side configuration, it adds the endpoints to configurations of the actual WCF services that it also generates.
2. Configuration
The following sections describe configuration parameters used by the generator.
2.1 Generator parameters
The following table lists configuration parameters that are set as the generator’s properties.
Parameter |
Value Example |
Description |
Generator Name |
WCF Configuration
|
The name of the current configuration of the generator that will appear in the model project and the build output. |
Folder |
Service Layer
|
Folder path to the generator inside the Model project. The folders are separated by a backslash (\). |
Include In Build |
True
|
A flag indicating whether or not running this generator should be included in building of the model project. |
Output |
Output Path |
../MySolution.Services.Wcf /serviceModel.services.config |
Relative path to the config file to add WCF configurations to.
|
Parameters |
Is Client |
False |
Specify whether to generate a client or a server configuration. |
Endpoint Behavior |
|
Endpoint behavior to set for all service endpoints. |
Service Behavior |
|
Service behavior to set for all services. Applicable only if Is Client is set to False. |
2.2 Model configuration
Endpoint configuration parameters for the generator are specified in the Xomega model in the wcf:endpoint-config
elements nested within the wcf:services-config node under the top level config element, which is conventionally
placed in the global_config.xom file.
For each type of endpoint that you want to generate, you can specify the type of WCF binding, the name of the binding configuration
to use, base local address, and a base remote address template, which may contain {Module/} and {File} placeholders, and
should be consistent with the output path configuration for the WCF Service Host Files
generator. The parent wcf:services-config element specifies the namespace of the service contracts and their implementations.
The following snippet illustrates such a configuration.
2.3 Common configurations
Typically there expected to be one configuration of this generator for the server-side, which updates WCF configuration
of the project for WCF services, and another configuration for the client-side, which adds endpoints to the WCF configuration
of a client project, such as a WPF project. If there are multiple clients using the same WCF services, then there may be
several client-side configurations for each project.
3. How to use the generator
The sections below provide some details on how to work with the generator.
3.1 Running the generator
You can run this generator for the entire model only.
You can rerun the generator when you add new services to the system, which happens if you add operations to a model
object that didn't have any operations, or when you change any endpoint or services configurations in the model.
This is usually the case during initial active prototyping or development of the system. Therefore, this generator can
be included in the build of the model project in its configuration initially, and then, once the list of services and
WCF configuration is stable, can be excluded from the model build.
3.2 Customizing the output
You can update parameters for individual endpoints in the corresponding target config files, and they will be preserved
during subsequent generator runs, if you don't change the endpoint names.
3.3 Cleaning generator’s output
This generator does not support cleaning generated endpoints from the target config files, since they may have custom changes.
In order to clean the endpoints in case when a service is removed or configuration is changed, you have to manually remove
or update the generated endpoint or service configurations accordingly.