--- source_files: - Common/DTS.Common.ServiceLibrary/ServiceLibrary.cs - Common/DTS.Common.ServiceLibrary/IServiceLibrary.cs generated_at: "2026-04-17T16:36:19.055239+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "50c5239dfd4ea753" --- # Documentation: DTS.Common.ServiceLibrary ## 1. Purpose This module provides a Windows Communication Foundation (WCF) service implementation that serves as a basic service library template within the DTS system. It defines a service contract (`IServiceLibrary`) and its implementation (`ServiceLibrary`) with two operations: a simple echo-style data retrieval method and a data contract manipulation method. This appears to be foundational infrastructure code, likely serving as a reference implementation or base service layer that other services in the system may extend or emulate. --- ## 2. Public Interface ### Interface: `IServiceLibrary` **Location:** `IServiceLibrary.cs` **Attribute:** `[ServiceContract]` | Method | Signature | Description | |--------|-----------|-------------| | `GetData` | `string GetData(int value)` | Accepts an integer and returns a formatted string: `"You entered: {value}"`. Marked with `[OperationContract]`. | | `GetDataUsingDataContract` | `CompositeType GetDataUsingDataContract(CompositeType composite)` | Accepts a `CompositeType` object, conditionally modifies its `StringValue` property, and returns it. Marked with `[OperationContract]`. | --- ### Class: `ServiceLibrary` **Location:** `ServiceLibrary.cs` **Implements:** `IServiceLibrary` | Method | Behavior | |--------|----------| | `string GetData(int value)` | Returns `string.Format("You entered: {0}", value)`. | | `CompositeType GetDataUsingDataContract(CompositeType composite)` | Throws `ArgumentNullException` if `composite` is null. If `composite.BoolValue` is `true`, appends `"Suffix"` to `composite.StringValue`. Returns the modified `composite` object. | --- ### Class: `CompositeType` **Location:** `IServiceLibrary.cs` **Attribute:** `[DataContract]` | Property | Type | Default Value | Attribute | Description | |----------|------|---------------|-----------|-------------| | `BoolValue` | `bool` | `true` | `[DataMember]` | Boolean flag that controls suffix-appending behavior in `GetDataUsingDataContract`. | | `StringValue` | `string` | `"Hello "` | `[DataMember]` | String value that may be modified by `GetDataUsingDataContract`. | --- ## 3. Invariants 1. **Null Argument Handling:** `GetDataUsingDataContract(CompositeType composite)` will always throw `ArgumentNullException` when called with a null reference. The parameter name passed to the exception constructor is `"composite"`. 2. **Conditional Mutation:** In `GetDataUsingDataContract`, the string `"Suffix"` is appended to `StringValue` **if and only if** `BoolValue` evaluates to `true`. No modification occurs when `BoolValue` is `false`. 3. **Default State of CompositeType:** Newly instantiated `CompositeType` objects will always have `BoolValue = true` and `StringValue = "Hello "` unless explicitly changed. 4. **Return Value:** `GetDataUsingDataContract` always returns the same object reference passed in; it never creates a new instance. --- ## 4. Dependencies ### This Module Depends On