CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
DataPortalBroker.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="DataPortalBroker.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Allows interception of DataPortal call</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Threading.Tasks;
10
11namespace Csla.Server
12{
18 {
23 public static IDataPortalServer DataPortalServer { get; set; }
24
34 public Task<DataPortalResult> Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
35 {
36 if (DataPortalServer != null)
37 {
38 return DataPortalServer.Create(objectType, criteria, context, isSync);
39 }
40 else
41 {
42 var dp = new DataPortalSelector();
43 return dp.Create(objectType, criteria, context, isSync);
44 }
45 }
46
56 public Task<DataPortalResult> Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
57 {
58 if (DataPortalServer != null)
59 {
60 return DataPortalServer.Fetch(objectType, criteria, context, isSync);
61 }
62 else
63 {
64 var dp = new DataPortalSelector();
65 return dp.Fetch(objectType, criteria, context, isSync);
66 }
67 }
68
77 public Task<DataPortalResult> Update(object obj, DataPortalContext context, bool isSync)
78 {
79 if (DataPortalServer != null)
80 {
81 return DataPortalServer.Update(obj, context, isSync);
82 }
83 else
84 {
85 var dp = new DataPortalSelector();
86 return dp.Update(obj, context, isSync);
87 }
88 }
89
99 public Task<DataPortalResult> Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
100 {
101 if (DataPortalServer != null)
102 {
103 return DataPortalServer.Delete(objectType, criteria, context, isSync);
104 }
105 else
106 {
107 var dp = new DataPortalSelector();
108 return dp.Delete(objectType, criteria, context, isSync);
109 }
110 }
111 }
112}
Allows the Data Portal call to be intercepted by a custom IDataPortalServer implementation.
Task< DataPortalResult > Update(object obj, DataPortalContext context, bool isSync)
Update a business object.
Task< DataPortalResult > Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
Create a new business object.
static IDataPortalServer DataPortalServer
Gets or sets a reference to a implementation of IDataPortalServer to be used.
Task< DataPortalResult > Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
Get an existing business object.
Task< DataPortalResult > Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
Delete a business object.
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.
Interface implemented by server-side data portal components.
Task< DataPortalResult > Update(object obj, DataPortalContext context, bool isSync)
Update a business object.
Task< DataPortalResult > Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
Create a new business object.
Task< DataPortalResult > Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
Get an existing business object.
Task< DataPortalResult > Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
Delete a business object.