Skip to content

Commit 22e5bc1

Browse files
Introduce ICslaObject interface for improved trimming support in CSLA 9.0 (#4738)
* Initial plan * Initial plan for ICslaObject interface implementation Co-authored-by: rockfordlhotka <[email protected]> * Implement ICslaObject interface and update data portal interfaces Co-authored-by: rockfordlhotka <[email protected]> * Update IChildDataPortal and ChildDataPortal to use ICslaObject Co-authored-by: rockfordlhotka <[email protected]> * Fix build issues: Add missing using statements and revert global.json Co-authored-by: rockfordlhotka <[email protected]> * Add ICslaObject constraint to DataPortal&lt;T&gt; generic type parameter Co-authored-by: rockfordlhotka <[email protected]> * Fix constraint order: change to where T : notnull, ICslaObject Co-authored-by: rockfordlhotka <[email protected]> * Update to .NET 10 rc2 * Add polyfill for net462 * Solution now builds * Update Polyfill package from 7.4.0 to 8.9.0 and remove RangeIndexPolyfill.cs Co-authored-by: rockfordlhotka <[email protected]> * Change Execute and ExecuteAsync methods to use ICommandObject instead of ICslaObject Co-authored-by: rockfordlhotka <[email protected]> * Change Create and Fetch methods to return ICslaObject instead of object Co-authored-by: rockfordlhotka <[email protected]> * Fix build errors due to ICommandObject usage --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: rockfordlhotka <[email protected]> Co-authored-by: Rockford Lhotka <[email protected]>
1 parent 2f0e3b3 commit 22e5bc1

37 files changed

+143
-99
lines changed

Source/Csla.AspNetCore/Csla.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
2020
<FrameworkReference Include="Microsoft.AspNetCore.App" />
21-
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.0-rc.1.25451.107" />
21+
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.0-rc.2.25502.107" />
2222
</ItemGroup>
2323
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
2424
<FrameworkReference Include="Microsoft.AspNetCore.App" />

Source/Csla.Blazor.WebAssembly/Csla.Blazor.WebAssembly.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="System.Net.Http.Json" Version="10.0.0-rc.1.25451.107" />
24+
<PackageReference Include="System.Net.Http.Json" Version="10.0.0-rc.2.25502.107" />
2525
</ItemGroup>
2626
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
27-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0-rc.1.25451.107" />
27+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0-rc.2.25502.107" />
2828
</ItemGroup>
2929
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
3030
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />

Source/Csla.Blazor/Csla.Blazor.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
</ItemGroup>
2323

2424
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
25-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="10.0.0-rc.1.25451.107" />
26-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0-rc.1.25451.107" />
27-
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.0-rc.1.25451.107" />
25+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="10.0.0-rc.2.25502.107" />
26+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0-rc.2.25502.107" />
27+
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.0-rc.2.25502.107" />
2828
</ItemGroup>
2929
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
3030
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.0" />

Source/Csla.Channels.Grpc/GrpcPortal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public async Task<DataPortalResponse> Update(UpdateRequest request)
259259
request.ClientUICulture,
260260
Deserialize<IContextDictionary>(request.ClientContext));
261261

262-
var dpr = await dataPortalServer.Update(obj, context, true);
262+
var dpr = await dataPortalServer.Update((ICslaObject)obj, context, true);
263263

264264
if (dpr.Error != null)
265265
result.ErrorData = _applicationContext.CreateInstanceDI<DataPortalErrorInfo>(dpr.Error);

Source/Csla.Channels.RabbitMq/RabbitMqPortal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ private async Task<DataPortalResponse> Update(UpdateRequest request)
246246
request.ClientUICulture,
247247
Deserialize<IContextDictionary>(request.ClientContext));
248248

249-
var dpr = await _dataPortalServer.Update(obj, context, true);
249+
var dpr = await _dataPortalServer.Update((ICslaObject)obj, context, true);
250250

251251
if (dpr.Error != null)
252252
result.ErrorData = _applicationContext.CreateInstanceDI<DataPortalErrorInfo>(dpr.Error);

Source/Csla.Channels.RabbitMq/RabbitMqProxy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//-----------------------------------------------------------------------
88

99
using System.Diagnostics.CodeAnalysis;
10+
using Csla.Core;
1011
using Csla.DataPortalClient;
1112
using Csla.Server;
1213
using RabbitMQ.Client;
@@ -160,7 +161,7 @@ public override async Task<DataPortalResult> Fetch(Type objectType, object crite
160161
}
161162

162163
/// <inheritdoc />
163-
public override async Task<DataPortalResult> Update(object obj, DataPortalContext context, bool isSync)
164+
public override async Task<DataPortalResult> Update(ICslaObject obj, DataPortalContext context, bool isSync)
164165
{
165166
if (obj is null)
166167
throw new ArgumentNullException(nameof(obj));

Source/Csla.Web.Mvc.Shared/Server/Hosts/HttpPortal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public async Task<DataPortalResponse> Update(UpdateRequest request)
154154
request.ClientUICulture,
155155
DeserializeRequired<IContextDictionary>(request.ClientContext));
156156

157-
var dpr = await dataPortalServer.Update(obj, context, true);
157+
var dpr = await dataPortalServer.Update((ICslaObject)obj, context, true);
158158

159159
if (dpr.Error != null)
160160
result.ErrorData = _applicationContext.CreateInstance<DataPortalErrorInfo>(_applicationContext, dpr.Error);

Source/Csla/Core/FieldManager/FieldDataManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ public void UpdateChildren(params object[] parameters)
650650
{
651651
if (item != null)
652652
{
653-
object? obj = item.Value;
653+
var obj = item.Value as ICslaObject;
654654
if (obj is IEditableBusinessObject || obj is IEditableCollection)
655655
dp.UpdateChild(obj, parameters);
656656
}
@@ -670,7 +670,7 @@ public void UpdateAllChildren(params object[] parameters)
670670
{
671671
if (item != null)
672672
{
673-
object? obj = item.Value;
673+
var obj = item.Value as ICslaObject;
674674
if (obj is IEditableBusinessObject || obj is IEditableCollection)
675675
portal.UpdateAll(obj, parameters);
676676
}
@@ -689,7 +689,7 @@ public async Task UpdateChildrenAsync(params object[] parameters)
689689
{
690690
if (item != null)
691691
{
692-
object? obj = item.Value;
692+
var obj = item.Value as ICslaObject;
693693
if (obj is IEditableBusinessObject || obj is IEditableCollection)
694694
await portal.UpdateAsync(obj, parameters).ConfigureAwait(false);
695695
}
@@ -709,7 +709,7 @@ public async Task UpdateAllChildrenAsync(params object[] parameters)
709709
{
710710
if (item != null)
711711
{
712-
object? obj = item.Value;
712+
var obj = item.Value as ICslaObject;
713713
if (obj is IEditableBusinessObject || obj is IEditableCollection)
714714
await portal.UpdateAllAsync(obj, parameters).ConfigureAwait(false);
715715
}

Source/Csla/Core/FieldManager/IFieldData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Csla.Core.FieldManager
1313
/// Defines the members required by a field
1414
/// data storage object.
1515
/// </summary>
16-
public interface IFieldData : ITrackStatus, IMobileObject
16+
public interface IFieldData : ITrackStatus, IMobileObject, ICslaObject
1717
{
1818
/// <summary>
1919
/// Gets the name of the field.

Source/Csla/Core/IBusinessObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Csla.Core
1111
/// This is the core interface implemented
1212
/// by all CSLA .NET base classes.
1313
/// </summary>
14-
public interface IBusinessObject
14+
public interface IBusinessObject : ICslaObject
1515
{
1616
/// <summary>
1717
/// Gets a value representing this object instance's

0 commit comments

Comments
 (0)