10using System.Threading.Tasks;
24 private Server.IDataPortalServer _portal =
new Server.DataPortal();
36 public async Task<DataPortalResult>
Create(
39 if (isSync ||
Csla.
ApplicationContext.LogicalExecutionLocation == ApplicationContext.LogicalExecutionLocations.Server)
41 return await _portal.
Create(objectType, criteria, context, isSync);
46 return await Task.Run(() => this._portal.
Create(objectType, criteria, context, isSync));
48 return await await Task.Factory.StartNew(() => this._portal.
Create(objectType, criteria, context, isSync),
49 CancellationToken.None,
50 TaskCreationOptions.None,
51 TaskScheduler.FromCurrentSynchronizationContext());
67 if (isSync ||
Csla.
ApplicationContext.LogicalExecutionLocation == ApplicationContext.LogicalExecutionLocations.Server)
69 return await _portal.
Fetch(objectType, criteria, context, isSync);
74 return await Task.Run(() => this._portal.
Fetch(objectType, criteria, context, isSync));
76 return await await Task.Factory.StartNew(() => this._portal.
Fetch(objectType, criteria, context, isSync),
77 CancellationToken.None,
78 TaskCreationOptions.None,
79 TaskScheduler.FromCurrentSynchronizationContext());
94 if (isSync ||
Csla.
ApplicationContext.LogicalExecutionLocation == ApplicationContext.LogicalExecutionLocations.Server)
96 return await _portal.
Update(obj, context, isSync);
101 return await Task.Run(() => this._portal.
Update(obj, context, isSync));
103 return await await Task.Factory.StartNew(() => this._portal.
Update(obj, context, isSync),
104 CancellationToken.None,
105 TaskCreationOptions.None,
106 TaskScheduler.FromCurrentSynchronizationContext());
122 if (isSync ||
Csla.
ApplicationContext.LogicalExecutionLocation == ApplicationContext.LogicalExecutionLocations.Server)
124 return await _portal.
Delete(objectType, criteria, context, isSync);
129 return await Task.Run(() => this._portal.
Delete(objectType, criteria, context, isSync));
131 return await await Task.Factory.StartNew(() => this._portal.
Delete(objectType, criteria, context, isSync),
132 CancellationToken.None,
133 TaskCreationOptions.None,
134 TaskScheduler.FromCurrentSynchronizationContext());
145 get {
return false; }
158 if (ConfigurationManager.AppSettings[
"CslaFlowSynchronizationContext"] ==
null)
161 return bool.Parse(ConfigurationManager.AppSettings[
"CslaFlowSynchronizationContext"]);
Implements a data portal proxy to relay data portal calls to an application server hosted locally in ...
bool FlowSynchronizationContext
Gets a value indicating whether any synchronization context should be flowed to child tasks.
bool IsServerRemote
Gets a value indicating whether this proxy will invoke a remote data portal server,...
async Task< DataPortalResult > Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
Called by DataPortal to create a new business object.
async Task< DataPortalResult > Update(object obj, DataPortalContext context, bool isSync)
Called by DataPortal to update a business object.
async Task< DataPortalResult > Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
Called by DataPortal to load an existing business object.
async Task< DataPortalResult > Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
Called by DataPortal to delete a business object.
Provides consistent context information between the client and server DataPortal objects.
Interface implemented by client-side data portal proxy objects.
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.