CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
CustomDataPortalServer.cs
Go to the documentation of this file.
1using System;
2using System.Threading.Tasks;
3
4using Csla.Server;
5
7{
9 {
10 private readonly DataPortalSelector _dataPortalSelector;
11
12 public CustomDataPortalServer(DataPortalSelector dataPortalSelector)
13 {
14 _dataPortalSelector = dataPortalSelector;
15 }
16
17 public async Task<DataPortalResult> Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
18 {
19 var result = await _dataPortalSelector.Create(objectType, criteria, context, isSync).ConfigureAwait(false);
20
21 TestResults.AddOrOverwrite("CustomDataPortalServer", "Create Called");
22
23 return result;
24 }
25
26 public async Task<DataPortalResult> Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
27 {
28 var result = await _dataPortalSelector.Fetch(objectType, criteria, context, isSync).ConfigureAwait(false);
29
30 TestResults.AddOrOverwrite("CustomDataPortalServer", "Fetch Called");
31
32 return result;
33 }
34
35 public async Task<DataPortalResult> Update(object obj, DataPortalContext context, bool isSync)
36 {
37 var result = await _dataPortalSelector.Update(obj, context, isSync).ConfigureAwait(false);
38
39 TestResults.AddOrOverwrite("CustomDataPortalServer", "Update Called");
40
41 return result;
42 }
43
44 public async Task<DataPortalResult> Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
45 {
46 var result = await _dataPortalSelector.Delete(objectType, criteria, context, isSync).ConfigureAwait(false);
47
48 TestResults.AddOrOverwrite("CustomDataPortalServer", "Delete Called");
49
50 return result;
51 }
52 }
53}
Provides consistent context information between the client and server DataPortal objects.
Selects the appropriate data portal implementation to invoke based on the object and configuration.
async Task< DataPortalResult > Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
Delete a business object.
async Task< DataPortalResult > Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
Get an existing business object.
CustomDataPortalServer(DataPortalSelector dataPortalSelector)
async Task< DataPortalResult > Update(object obj, DataPortalContext context, bool isSync)
Update a business object.
async Task< DataPortalResult > Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
Create a new business object.
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
Definition: TestResults.cs:21
static void AddOrOverwrite(string key, string value)
Overwrite an item in the test results, to indicate an outcome of a particular operation
Definition: TestResults.cs:39
Interface implemented by server-side data portal components.