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
Copy file name to clipboardExpand all lines: docs/Upgrading to CSLA 10.md
+111-5Lines changed: 111 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,13 @@ If you are upgrading from a version of CSLA prior to 8, you should review the [U
8
8
9
9
## Platform Support
10
10
11
-
TBD
11
+
CSLA 10 continues to support .NET Framework 4.6.2 and later, as well as modern .NET versions. CSLA 10 adds support for .NET 10.
12
12
13
13
## RevalidatingInterceptor
14
14
15
15
The constructor has changed and now expects an `IOptions<RevalidatingInterceptorOptions>` instance. With this new options object it is now possible to skip the revalidation of business rules during a `Delete` operation.
16
16
To configure the new options we are using the .Net [Options pattern](https://learn.microsoft.com/en-us/dotnet/core/extensions/options).
* to handle the exception when `CanHandle(...) == true`
32
+
* to handle the exception when `CanHandle(...) == true`
33
+
32
34
With these methods you can now decide whether to handle the exception and how or let the exception be unobserved bubble up and potentially cause a crash.
33
35
34
36
You can register your implementation in two ways
37
+
35
38
* Just add the implementation to your service collection `services.AddScoped<IUnhandledAsyncRuleExceptionHandler, YourImplementation>()`
36
39
* Note: This has to be registered _after_ csla is added to the service collection.
37
40
* Use `services.AddCsla(o => o.UseUnhandledAsyncRuleExceptionHandler<YourImplementation>());`. The handler is registered as scoped.
38
41
39
42
The _default_ is still no handling of any exception thrown in an asynchronous rule.
Both interfaces `IDataPortal` and `IChildDataPortal` got the following changes to improve trimming support:
43
47
* Returning `ICslaObject`instead of `object`.
44
48
*`Update`/`Execute` now expect an `ICslaObject` parameter instead of `object`.
45
49
46
50
## `InjectAttribute` - AllowNull addition
51
+
47
52
The `InjectAttribute` got a new property called `AllowNull`. This property controls whether csla will use `GetService` or `GetRequiredService`.
48
53
With `AllowNull == true` means it's using `GetService` which can return a `null` for a requested object.
49
54
With `AllowNull == false` means it's using `GetRequiredService` which can not return `null` and will cause an exception.
@@ -128,8 +133,109 @@ Supporting nullable types means that some APIs have changed to support nullable
128
133
*`UpdateRequest` now uses `[AutoSerializable]` to auto implement `IMobileObject` instead of inheriting from `ReadOnlyBase`.
129
134
130
135
136
+
## `ViewModel<T>.SaveAsync` and `CslaDataProvider.Refresh` return `Task`
137
+
138
+
The `ViewModel<T>.SaveAsync(object sender, ExecuteEventArgs e)` method and `CslaDataProvider.Refresh<T>(Func<Task<T>> factory)` method now return `Task` instead of `async void`. This is a breaking change for any code that calls these methods directly.
139
+
140
+
If you were calling these methods without awaiting them, you will now need to handle the returned `Task` appropriately:
141
+
142
+
```csharp
143
+
// Before (async void - fire and forget)
144
+
viewModel.SaveAsync(sender, e);
145
+
146
+
// After (returns Task - must be handled)
147
+
awaitviewModel.SaveAsync(sender, e);
148
+
// or if you truly want fire-and-forget behavior:
149
+
_=viewModel.SaveAsync(sender, e);
150
+
```
151
+
152
+
## OpenTelemetry Instrumentation
153
+
154
+
CSLA 10 adds OpenTelemetry instrumentation for the data portal. A new `OpenTelemetryDashboard` class provides metrics for data portal operations including total calls, completed calls, failed calls, and call duration.
155
+
156
+
To enable OpenTelemetry metrics, register the dashboard:
157
+
158
+
```csharp
159
+
services.AddCsla(o=>o.DataPortal(dp=>
160
+
dp.RegisterDashboard<OpenTelemetryDashboard>()));
161
+
```
162
+
163
+
The metrics integrate with standard OpenTelemetry consumers such as Prometheus, Grafana, Azure Monitor, and .NET Aspire dashboards.
164
+
165
+
## Virtual `Deserialized` Method
166
+
167
+
A new `protected virtual void Deserialized()` method has been added to `BusinessBase`, `ExtendedBindingList`, and `ObservableBindingList`. This method is called after deserialization completes and provides an extension point for custom post-deserialization logic.
A new `IMobileObjectMetastate` interface has been added to `Csla.Serialization.Mobile`. This interface is intended for developers creating custom serializers as an alternative to `MobileFormatter`.
183
+
184
+
The interface defines two methods:
185
+
*`byte[] GetMetastate()` - Gets lightweight serialization of field values (metastate) without child object references
186
+
*`void SetMetastate(byte[] metastate)` - Sets the metastate from a byte array
187
+
188
+
This interface is implemented on `MobileObject`, `MobileBindingList`, and `ReadOnlyListBase`. The metastate is intended for transitory data serialization, not long-term storage.
189
+
190
+
## Binary Serialization for Metastate
191
+
192
+
The internal serialization of metastate data now uses binary serialization instead of JSON. This provides improved performance for data portal operations. Since CSLA requires the same version on both ends of a network connection, this change is transparent to most applications.
193
+
194
+
## Principal Caching Removed
195
+
196
+
`ApplicationContextManager.GetUser()` no longer caches the current principal. It now always retrieves the principal from `Thread.CurrentPrincipal`. This improves behavior in multi-threaded scenarios and prevents stale principal references.
197
+
198
+
If your code relied on the previous caching behavior, you may need to review your authorization logic.
199
+
200
+
## `TransactionIsolationLevel.Snapshot`
201
+
202
+
A new `Snapshot` option has been added to the `TransactionIsolationLevel` enum. This allows use of snapshot isolation when using the `Transactional` attribute:
The `Csla.Xaml.PropertyInfo` component now includes a `FriendlyName` property that can be used to display a user-friendly property name in WPF/XAML applications.
215
+
216
+
## `RuleContextModes` for Rule Execution Control
217
+
218
+
A new `RuleContextModes` enum has been added to provide control over when rules execute. The `RuleContext` now includes an `ExecuteContext` property with the following flags:
219
+
*`Any` - Rule executes in any context
220
+
*`CheckRules` - Rule executes during CheckRules calls
221
+
*`CheckObjectRules` - Rule executes during CheckObjectRules calls
222
+
*`PropertyChanged` - Rule executes when the property changes
223
+
*`AsAffectedProperty` - Rule executes as an affected property
224
+
225
+
## `ScanForDataAnnotations` Configuration Option
226
+
227
+
A new configuration option `CslaOptions.ScanForDataAnnotations(bool flag)` allows disabling the automatic scanning for DataAnnotations attributes on business objects.
> **Caution:** Setting this to `false` completely disables DataAnnotations attribute support within CSLA. Only use this option if you are certain your application does not use DataAnnotations attributes for validation and you need the performance benefit of skipping the attribute scan.
0 commit comments