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
Both interfaces `IDataPortal` and `IChildDataPortal` got the following changes to improve trimming support:
43
+
* Returning `ICslaObject`instead of `object`.
44
+
*`Update`/`Execute` now expect an `ICslaObject` parameter instead of `object`.
45
+
46
+
## `InjectAttribute` - AllowNull addition
47
+
The `InjectAttribute` got a new property called `AllowNull`. This property controls whether csla will use `GetService` or `GetRequiredService`.
48
+
With `AllowNull == true` means it's using `GetService` which can return a `null` for a requested object.
49
+
With `AllowNull == false` means it's using `GetRequiredService` which can not return `null` and will cause an exception.
50
+
Furthermore you can ignore the new property if you are working with the nullable reference types. In that case the `AllowNull` is implicitly declared by your parameter declaration. For example:
In the example above `service1` will be resolved with `GetRequiredService` while `service2` will be resolved with `GetService`. You can also set `AllowNull` which will override the nullable reference annotation. The other way around `[Inject(AllowNull = false)] IService4? service4` will _not_ change the parameter to be not-null. In this case the annotation takes precedence.
The `BusinessBase` implementation of [IDataErrorInfo](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.idataerrorinfo?view=net-10.0) and [INotifyDataErrorInfo](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifydataerrorinfo?view=net-10.0) now provide `virtual` methods to change the behavior.
Data=""; // This will now result in an ArgumentNullException because the needed ApplicationContext is not available yet.
88
+
}
89
+
}
90
+
```
91
+
92
+
### Explanation
93
+
43
94
CSLA 10 supports the use of nullable reference types in your code. This means that you can use the `#nullable enable` directive in your code and the compiler will now tell you where CSLA does not expect any `null` values or returns `null`.
44
95
45
96
Supporting nullable types means that some APIs have changed to support nullable types.
0 commit comments