-
-
Notifications
You must be signed in to change notification settings - Fork 408
/
Copy pathIDataPortalT.cs
129 lines (127 loc) · 5.08 KB
/
IDataPortalT.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//-----------------------------------------------------------------------
// <copyright file="IDataPortalT.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Interface defining the members of the data portal type</summary>
//-----------------------------------------------------------------------
using System.Diagnostics.CodeAnalysis;
namespace Csla
{
/// <summary>
/// Interface defining the members of the data portal type.
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IDataPortal<
#if NET8_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
#endif
T>
{
/// <summary>
/// Starts an asynchronous data portal operation to
/// create a business object.
/// </summary>
/// <param name="criteria">
/// Criteria describing the object to create.
/// </param>
Task<T> CreateAsync(params object[] criteria);
/// <summary>
/// Starts an asynchronous data portal operation to
/// create a business object.
/// </summary>
/// <param name="criteria">
/// Criteria describing the object to create.
/// </param>
Task<T> FetchAsync(params object[] criteria);
/// <summary>
/// Called by a factory method in a business class or
/// by the UI to update an object.
/// </summary>
/// <param name="obj">Object to update.</param>
Task<T> UpdateAsync(T obj);
/// <summary>
/// Called by a factory method in a business class or
/// by the UI to execute a command object.
/// </summary>
/// <param name="command">Command object to execute.</param>
Task<T> ExecuteAsync(T command);
/// <summary>
/// Execute a command on the logical server.
/// </summary>
/// <param name="criteria">
/// Criteria provided to the command object.
/// </param>
/// <returns>The resulting command object.</returns>
Task<T> ExecuteAsync(params object[] criteria);
/// <summary>
/// Called by a factory method in a business class or
/// by the UI to delete an object.
/// </summary>
/// <param name="criteria">Object-specific criteria.</param>
Task DeleteAsync(params object[] criteria);
/// <summary>
/// Called by a factory method in a business class to create
/// a new object, which is loaded with default
/// values from the database.
/// </summary>
/// <param name="criteria">Object-specific criteria.</param>
/// <returns>A new object, populated with default values.</returns>
T Create(params object[] criteria);
/// <summary>
/// Called by a factory method in a business class to retrieve
/// an object, which is loaded with values from the database.
/// </summary>
/// <param name="criteria">Object-specific criteria.</param>
/// <returns>An object populated with values from the database.</returns>
T Fetch(params object[] criteria);
/// <summary>
/// Called to execute a Command object on the server.
/// </summary>
/// <remarks>
/// <para>
/// To be a Command object, the object must inherit from
/// CommandBase.
/// </para><para>
/// Note that this method returns a reference to the updated business object.
/// If the server-side DataPortal is running remotely, this will be a new and
/// different object from the original, and all object references MUST be updated
/// to use this new object.
/// </para><para>
/// On the server, the Command object's DataPortal_Execute() method will
/// be invoked and on an ObjectFactory the Execute method will be invoked.
/// Write any server-side code in that method.
/// </para>
/// </remarks>
/// <param name="obj">A reference to the Command object to be executed.</param>
/// <returns>A reference to the updated Command object.</returns>
T Execute(T obj);
/// <summary>
/// Execute a command on the logical server.
/// </summary>
/// <param name="criteria">
/// Criteria provided to the command object.
/// </param>
/// <returns>The resulting command object.</returns>
T Execute(params object[] criteria);
/// <summary>
/// Called by the business object's Save() method to
/// insert, update or delete an object in the database.
/// </summary>
/// <remarks>
/// Note that this method returns a reference to the updated business object.
/// If the server-side DataPortal is running remotely, this will be a new and
/// different object from the original, and all object references MUST be updated
/// to use this new object.
/// </remarks>
/// <param name="obj">A reference to the business object to be updated.</param>
/// <returns>A reference to the updated business object.</returns>
T Update(T obj);
/// <summary>
/// Called by a Shared (static in C#) method in the business class to cause
/// immediate deletion of a specific object from the database.
/// </summary>
/// <param name="criteria">Object-specific criteria.</param>
void Delete(params object[] criteria);
}
}