9using System.Threading.Tasks;
37 public object Create(Type objectType)
41 return Create(objectType,
false).Result;
43 catch (AggregateException ex)
45 throw ex.InnerException;
56 public object Create(Type objectType, params
object[] parameters)
60 return Create(objectType,
true, parameters).Result;
62 catch (AggregateException ex)
64 throw ex.InnerException;
73 return (T) await
Create(typeof(T),
false).ConfigureAwait(
false);
84 return (T)await
Create(typeof(T),
true, parameters).ConfigureAwait(
false);
87 private async Task<object>
Create(Type objectType,
bool hasParameters, params
object[] parameters)
89 DataPortalTarget obj =
null;
95 obj.Child_OnDataPortalInvoke(eventArgs);
98 await obj.CreateChildAsync(parameters).ConfigureAwait(
false);
99 obj.OnDataPortalInvokeComplete(eventArgs);
108 obj.Child_OnDataPortalException(eventArgs, ex);
114 object outval =
null;
115 if (obj !=
null) outval = obj.Instance;
117 "ChildDataPortal.Create " + Properties.Resources.FailedOnServer, ex, outval);
121 object reference =
null;
123 reference = obj.Instance;
132 public object Fetch(Type objectType)
136 return Fetch(objectType,
false,
null).Result;
138 catch (AggregateException ex)
140 throw ex.InnerException;
151 public object Fetch(Type objectType, params
object[] parameters)
155 return Fetch(objectType,
true, parameters).Result;
157 catch (AggregateException ex)
159 throw ex.InnerException;
168 return (T)await
Fetch(typeof(T),
false).ConfigureAwait(
false);
179 return (T)await
Fetch(typeof(T),
true, parameters).ConfigureAwait(
false);
182 private async Task<object>
Fetch(Type objectType,
bool hasParameters, params
object[] parameters)
184 DataPortalTarget obj =
null;
192 obj.Child_OnDataPortalInvoke(eventArgs);
195 await obj.FetchChildAsync(parameters).ConfigureAwait(
false);
196 obj.Child_OnDataPortalInvokeComplete(eventArgs);
204 obj.Child_OnDataPortalException(eventArgs, ex);
210 object outval =
null;
211 if (obj !=
null) outval = obj.Instance;
213 "ChildDataPortal.Fetch " + Properties.Resources.FailedOnServer, ex, outval);
229 Update(obj,
false,
false,
null).Wait();
231 catch (AggregateException ex)
233 throw ex.InnerException;
244 public void Update(
object obj, params
object[] parameters)
248 Update(obj,
true,
false, parameters).Wait();
250 catch (AggregateException ex)
252 throw ex.InnerException;
262 await
Update(obj,
false,
false,
null).ConfigureAwait(
false);
272 public async Task
UpdateAsync(
object obj, params
object[] parameters)
274 await
Update(obj,
true,
false, parameters).ConfigureAwait(
false);
283 Update(obj,
false,
true,
null).Wait();
293 public void UpdateAll(
object obj, params
object[] parameters)
295 Update(obj,
true,
true, parameters).Wait();
304 await
Update(obj,
false,
true,
null).ConfigureAwait(
false);
316 await
Update(obj,
true,
true, parameters).ConfigureAwait(
false);
319 private async Task
Update(
object obj,
bool hasParameters,
bool bypassIsDirtyTest, params
object[] parameters)
324 if (obj is Core.BusinessBase busObj && busObj.IsDirty ==
false && bypassIsDirtyTest ==
false)
331 Type objectType = obj.GetType();
337 lb.Child_OnDataPortalInvoke(
339 await lb.UpdateChildAsync(parameters).ConfigureAwait(
false);
340 lb.Child_OnDataPortalInvokeComplete(
348 lb.Child_OnDataPortalException(
349 new DataPortalEventArgs(
null, objectType, obj, operation), ex);
356 "ChildDataPortal.Update " + Properties.Resources.FailedOnServer, ex, obj);
Provides consistent context information between the client and server DataPortal objects.
object CreateInstanceDI(Type objectType, params object[] parameters)
Creates an object using 'Activator.CreateInstance' using service provider (if one is available) to po...
Provides information about the DataPortal call.
This exception is returned for any errors occurring during the server-side DataPortal invocation.
Invoke data portal methods on child objects.
ChildDataPortal(ApplicationContext applicationContext)
Creates an instance of the type.
void Update(object obj, params object[] parameters)
Update a business object.
async Task UpdateAllAsync(object obj, params object[] parameters)
Update a business object.
void Update(object obj)
Update a business object.
async Task UpdateAsync(object obj, params object[] parameters)
Update a business object.
async Task< T > FetchAsync< T >()
Get an existing business object.
object Create(Type objectType)
Create a new business object.
object Fetch(Type objectType)
Get an existing business object.
async Task UpdateAllAsync(object obj)
Update a business object.
void UpdateAll(object obj, params object[] parameters)
Update a business object.
object Create(Type objectType, params object[] parameters)
Create a new business object.
void UpdateAll(object obj)
Update a business object.
object Fetch(Type objectType, params object[] parameters)
Get an existing business object.
async Task< T > CreateAsync< T >()
Create a new business object.
async Task UpdateAsync(object obj)
Update a business object.
DataPortalOperations
List of data portal operations.