From 5ebcfe8c75959354a4293ada7791df89708dba60 Mon Sep 17 00:00:00 2001
From: "Kevin E. Ford" <4380198+Bowman74@users.noreply.github.com.>
Date: Sun, 29 Dec 2024 14:01:58 -0700
Subject: [PATCH 1/2] #4417 Changes for data portal annotations
---
.../DataPortalClient/DataPortalFactory.cs | 36 +++++++++++--------
Source/Csla/IDataPortalFactory.cs | 8 ++++-
Source/Csla/IDataPortalT.cs | 8 ++++-
3 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/Source/Csla/DataPortalClient/DataPortalFactory.cs b/Source/Csla/DataPortalClient/DataPortalFactory.cs
index dcab490a8d..60980c919f 100644
--- a/Source/Csla/DataPortalClient/DataPortalFactory.cs
+++ b/Source/Csla/DataPortalClient/DataPortalFactory.cs
@@ -6,32 +6,38 @@
// Implements a data portal service
//-----------------------------------------------------------------------
+using System.Diagnostics.CodeAnalysis;
+
namespace Csla.DataPortalClient
{
- ///
- /// Get an access to a client-side data portal
- /// instance.
- ///
- public class DataPortalFactory : IDataPortalFactory
- {
///
- /// Creates an instance of the type.
+ /// Get an access to a client-side data portal
+ /// instance.
///
- /// Current ServiceProvider
- public DataPortalFactory(IServiceProvider serviceProvider)
+ public class DataPortalFactory : IDataPortalFactory
{
- ServiceProvider = serviceProvider;
- }
+ ///
+ /// Creates an instance of the type.
+ ///
+ /// Current ServiceProvider
+ public DataPortalFactory(IServiceProvider serviceProvider)
+ {
+ ServiceProvider = serviceProvider;
+ }
- private IServiceProvider ServiceProvider { get; set; }
+ private IServiceProvider ServiceProvider { get; set; }
///
/// Get a client-side data portal instance.
///
/// Root business object type
- public IDataPortal GetPortal()
+ public IDataPortal GetPortal<
+#if NET8_0_OR_GREATER
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
+#endif
+ T>()
{
- return (IDataPortal)ServiceProvider.GetService(typeof(IDataPortal));
+ return (IDataPortal)ServiceProvider.GetService(typeof(IDataPortal));
+ }
}
- }
}
diff --git a/Source/Csla/IDataPortalFactory.cs b/Source/Csla/IDataPortalFactory.cs
index 840a50fa08..f2a727b7cd 100644
--- a/Source/Csla/IDataPortalFactory.cs
+++ b/Source/Csla/IDataPortalFactory.cs
@@ -5,6 +5,8 @@
//
// Implements a data portal service
//-----------------------------------------------------------------------
+using System.Diagnostics.CodeAnalysis;
+
namespace Csla
{
///
@@ -18,6 +20,10 @@ public interface IDataPortalFactory
/// Get a client-side data portal instance.
///
/// Root business object type
- IDataPortal GetPortal();
+ IDataPortal GetPortal<
+#if NET8_0_OR_GREATER
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
+#endif
+ T>();
}
}
diff --git a/Source/Csla/IDataPortalT.cs b/Source/Csla/IDataPortalT.cs
index 1f5e4c17c3..e96ad80a70 100644
--- a/Source/Csla/IDataPortalT.cs
+++ b/Source/Csla/IDataPortalT.cs
@@ -6,13 +6,19 @@
// Interface defining the members of the data portal type
//-----------------------------------------------------------------------
+using System.Diagnostics.CodeAnalysis;
+
namespace Csla
{
///
/// Interface defining the members of the data portal type.
///
///
- public interface IDataPortal
+ public interface IDataPortal<
+#if NET8_0_OR_GREATER
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
+# endif
+ T>
{
///
/// Starts an asynchronous data portal operation to
From 7d12cf9fc2636ff6e8c3b9c6c50f53517954f955 Mon Sep 17 00:00:00 2001
From: "Kevin E. Ford" <4380198+Bowman74@users.noreply.github.com.>
Date: Sun, 29 Dec 2024 14:07:19 -0700
Subject: [PATCH 2/2] #4417 Fix spacing
---
.../DataPortalClient/DataPortalFactory.cs | 32 +++++++++----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/Source/Csla/DataPortalClient/DataPortalFactory.cs b/Source/Csla/DataPortalClient/DataPortalFactory.cs
index 60980c919f..7529feb8d6 100644
--- a/Source/Csla/DataPortalClient/DataPortalFactory.cs
+++ b/Source/Csla/DataPortalClient/DataPortalFactory.cs
@@ -10,22 +10,22 @@
namespace Csla.DataPortalClient
{
+ ///
+ /// Get an access to a client-side data portal
+ /// instance.
+ ///
+ public class DataPortalFactory : IDataPortalFactory
+ {
///
- /// Get an access to a client-side data portal
- /// instance.
+ /// Creates an instance of the type.
///
- public class DataPortalFactory : IDataPortalFactory
+ /// Current ServiceProvider
+ public DataPortalFactory(IServiceProvider serviceProvider)
{
- ///
- /// Creates an instance of the type.
- ///
- /// Current ServiceProvider
- public DataPortalFactory(IServiceProvider serviceProvider)
- {
- ServiceProvider = serviceProvider;
- }
+ ServiceProvider = serviceProvider;
+ }
- private IServiceProvider ServiceProvider { get; set; }
+ private IServiceProvider ServiceProvider { get; set; }
///
/// Get a client-side data portal instance.
@@ -33,11 +33,11 @@ public DataPortalFactory(IServiceProvider serviceProvider)
/// Root business object type
public IDataPortal GetPortal<
#if NET8_0_OR_GREATER
- [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
#endif
- T>()
+ T>()
{
- return (IDataPortal)ServiceProvider.GetService(typeof(IDataPortal));
- }
+ return (IDataPortal)ServiceProvider.GetService(typeof(IDataPortal));
}
+ }
}