You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The existing method without the version suffix (V0) remains available for backward compatibility, while the new method with the version suffix indicates the updated behavior. This allows consumers to choose when to adopt the new behavior without breaking existing integrations.
The behavior version always appears after the method name and before the Async suffix, making the behavior versions clear and unambiguous.
299
+
__(V0 is implied and does not need to be explicitly stated in [OperationBehaviorVersion] OR [ResourceContractVersion])__
302
300
303
-
**IMPORTANT:**
304
-
The version suffix on methods applies only to behavior changes, **not** model changes. This allows for granular control and makes it easy for consumers to identify which version of a method they are using, independent of the model version.
301
+
Example of method behavior versioning for a model version at V0:
305
302
306
-
- Do **not** include the model version in the method name, as it is already reflected in the service file name and interface contract. Including it in the method name is redundant and can cause confusion.
307
-
- Do **not** include the model version in the parameter name. This is also redundant and reduces readability.
Whenever the model version is incremented, the service filename and folder path must reflect the new model version, and the behavior version resets to V0:
The service method behavior version reset to V0 whenever a new model version is introduced.
340
-
Any further behavior changes for that model version will result in an increment of the
341
-
method behavior version (V1, V2, etc.), while the model version remains constant.
333
+
The service method behavior version resets to V0 whenever a new model version is introduced. Any further behavior changes for that model version will result in an increment of the method behavior version (V1, V2, etc.), while the model version remains constant.
342
334
343
335
344
336
**Example:**
345
337
346
338
Before model upgrade (model V1 with multiple behavior versions):
The new V2 model service only exposes the latest behavior under the implied V0 naming convention.
367
-
The parameter name in the method signature does not include the model version,
368
-
as it is already reflected in the service file name and path.
359
+
The V2 in this instance refers to the model version since it is appended to the resource.
360
+
The behavior version resets on a model upgrade and since the model is now at the implied V0 wedo
361
+
not have to indicate it after the operation.
369
362
370
-
TIP: Use XML documentation comments to indicate versioning details only at exposure layers where consumers do not have access to the source code. This ensures external consumers understand which model version is used and any behaviour changes, while avoiding unnecessary comments within internal or non-exposed layers where the code itself is already visible.
Classesmustbedeclaredwiththelowestpossiblevisibilityrequiredfor their intended use.
389
+
By default, types should be internal unless there is a clear and deliberate need to expose them outside the assembly.
390
+
391
+
This principle reduces the exposure surface area of a library, protects internal implementation details, and prevents unintended coupling by consumers.
392
+
393
+
A smaller public surface:
394
+
395
+
- Improves maintainability by allowing internal refactoring without breaking consumers
396
+
- Enforces clear architectural boundaries
397
+
- Limits misuse of internal logic that was never designed for external consumption
398
+
399
+
400
+
#### 2.0.4.0 Exception Visibility Rules
401
+
402
+
Exception types follow a stricter, intent-driven visibility model:
403
+
404
+
- **Localization Exceptions** — `public`
405
+
These represent well-defined, domain-specific failures that are meaningful to consumers.
406
+
They are expected to propagate beyond the library boundary and must therefore be accessible.
407
+
408
+
- **Categorization Exceptions** — `internal`
409
+
These are used strictly for internal classification and logging.
410
+
They must never escape the library boundary and should be stripped or translated at each layer.
411
+
Keeping them internal ensures they cannot leak into external contracts.
412
+
413
+
- **Exposure Exceptions** — `public`
414
+
These represent failures that are intentionally exposed to consumers (e.g., validationordependencyfailures).
- A versioned service with both model and behavior changes `{Entity}V{m}ServiceV{n}.cs`
427
-
- As the model version takes precedence, the behavior version resets to V0 with each new model version, and the method naming reflects only the new / latest behavior version:
| Model V2 |`StudentV2Service.cs`|`RetrieveStudentByIdAsync` (reset to V0) |
554
+
Visibility is not just an access modifier—it is a design decision that defines the boundary between what a library promises and what it is free to change.
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,8 @@ Chat with us here on Discord:
112
112
-[2.0.3.2 Service Behavior Versioning](https://github.com/hassanhabib/The-Standard/blob/master/2.%20Services/2.%20Services.md#2032-service-behavior-versioning)
113
113
-[2.0.3.3 Combined Model and Behavior Changes](https://github.com/hassanhabib/The-Standard/blob/master/2.%20Services/2.%20Services.md#2033-combined-model-and-behavior-changes)
-[2.0.4 Class Visibility and Exposure Control](https://github.com/hassanhabib/The-Standard/blob/master/2.%20Services/2.%20Services.md#204-class-visibility-and-exposure-control)
-[2.1 Foundation Services](https://github.com/hassanhabib/The-Standard/blob/master/2.%20Services/2.1%20Foundations/2.1%20Foundations.md#21-foundation-services-broker-neighboring)
0 commit comments