Skip to content

Commit 3bfa7b3

Browse files
committed
docs: add CoalesceOptions member docs
1 parent 0c9133d commit 3bfa7b3

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

docs/topics/startup.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,53 @@ Specify a service implementation to use to resolve the current timezone. This sh
7272

7373
<Prop def="public Builder Configure(Action<CoalesceOptions> setupAction)" />
7474

75-
Configure additional options for Coalesce runtime behavior. Current options include options for server-side validation, and options for exception handling. See individual members for details.
75+
Configure additional options for Coalesce runtime behavior. Current options include options for server-side validation, and options for exception handling. See [CoalesceOptions Properties](#coalesceoptions-properties) below for details.
76+
77+
## CoalesceOptions Properties
78+
79+
The following properties are available on `CoalesceOptions` when using the `.Configure()` builder method:
80+
81+
<Prop def="public bool DetailedExceptionMessages { get; set; }" lang="c#" />
82+
83+
Determines whether API controllers will return the `Exception.Message` of unhandled exceptions or not.
84+
85+
Defaults to `true` if `IHostingEnvironment.EnvironmentName` is "Development"; otherwise `false`.
86+
87+
<Prop def="public Func<ActionExecutedContext, ApiResult?>? ExceptionResponseFactory { get; set; }" lang="c#" />
88+
89+
A function that will transform an unhandled exception in API controllers into a custom `ApiResult` object that will be sent to the client. Return `null` to use the default response handling.
90+
91+
This allows you to customize error responses for specific exception types, such as returning a 404 status code for `FileNotFoundException`.
92+
93+
<Prop def="public bool DetailedEfMigrationExceptionMessages { get; set; }" lang="c#" />
94+
95+
Determines whether detailed error messages about EF model/migration errors are returned in error responses.
96+
97+
Requires `DetailedExceptionMessages` to be enabled, and defaults to that value.
98+
99+
<Prop def="public bool DetailedEfConstraintExceptionMessages { get; set; }" lang="c#" />
100+
101+
If `true`, Coalesce will transform some database exceptions into user-friendly messages when these exceptions occur in Save and Delete operations through `StandardBehaviors<T>`. For SQL Server, this includes foreign key constraint violations and unique index violations.
102+
103+
These messages respect the security configuration of your models. These messages only serve as a fallback to produce a more acceptable user experience in cases where the developer neglects to add appropriate validation or other handling of related entities.
104+
105+
Defaults to `true`.
106+
107+
<Prop def="public bool ValidateAttributesForSaves { get; set; }" lang="c#" />
108+
109+
If `true`, Coalesce will perform validation of incoming data using `ValidationAttribute`s present on your models during save operations (in `StandardBehaviors<T>.ValidateDto(SaveKind, IParameterDto<T>)`).
110+
111+
This can be overridden on individual Behaviors instances by setting `StandardBehaviors<T>.ValidateAttributesForSaves`.
112+
113+
Defaults to `true`.
114+
115+
<Prop def="public bool ValidateAttributesForMethods { get; set; }" lang="c#" />
116+
117+
If `true`, Coalesce will perform validation of incoming parameters using `ValidationAttribute`s present on your parameters and for custom methods.
118+
119+
This can be overridden on individual custom methods using `ExecuteAttribute.ValidateAttributes`.
120+
121+
Defaults to `true`.
76122

77123
## Middleware & Helpers
78124

0 commit comments

Comments
 (0)