10using System.Collections.Generic;
15using System.Threading.Tasks;
17using System.Security.Principal;
33#pragma warning disable 1998
35#pragma warning restore 1998
51 (IPrincipal)SerializationFormatterFactory.GetFormatter().Deserialize(request.
Principal),
59 var dpr = await prtl.
Create(objectType, criteria, context,
true);
61 if (dpr.Error !=
null)
63 result.GlobalContext = SerializationFormatterFactory.GetFormatter().Serialize(dpr.GlobalContext);
64 result.ObjectData = SerializationFormatterFactory.GetFormatter().Serialize(dpr.ReturnObject);
82#pragma warning disable 1998
84#pragma warning restore 1998
100 (IPrincipal)SerializationFormatterFactory.GetFormatter().Deserialize(request.
Principal),
108 var dpr = await prtl.
Fetch(objectType, criteria, context,
true);
110 if (dpr.Error !=
null)
112 result.GlobalContext = SerializationFormatterFactory.GetFormatter().Serialize(dpr.GlobalContext);
113 result.ObjectData = SerializationFormatterFactory.GetFormatter().Serialize(dpr.ReturnObject);
131#pragma warning disable 1998
133#pragma warning restore 1998
143 (IPrincipal)SerializationFormatterFactory.GetFormatter().Deserialize(request.
Principal),
151 var dpr = await prtl.
Update(obj, context,
true);
153 if (dpr.Error !=
null)
156 result.GlobalContext = SerializationFormatterFactory.GetFormatter().Serialize(dpr.GlobalContext);
157 result.ObjectData = SerializationFormatterFactory.GetFormatter().Serialize(dpr.ReturnObject);
175#pragma warning disable 1998
177#pragma warning restore 1998
193 (IPrincipal)SerializationFormatterFactory.GetFormatter().Deserialize(request.
Principal),
201 var dpr = await prtl.
Delete(objectType, criteria, context,
true);
203 if (dpr.Error !=
null)
205 result.GlobalContext = SerializationFormatterFactory.GetFormatter().Serialize(dpr.GlobalContext);
206 result.ObjectData = SerializationFormatterFactory.GetFormatter().Serialize(dpr.ReturnObject);
222 private static object GetCriteria(
byte[] criteriaData)
224 object criteria =
null;
225 if (criteriaData !=
null)
226 criteria = SerializationFormatterFactory.GetFormatter().Deserialize(criteriaData);
232 #region Extention Method for Requests
264 #endregion Extention Method for Requests
Dictionary type that is serializable with the SerializationFormatterFactory.GetFormatter().
Class used as a wrapper for criteria based requests that use primitives
Provides consistent context information between the client and server DataPortal objects.
Implements the server-side DataPortal message router as discussed in Chapter 4.
async Task< DataPortalResult > Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
Get an existing business object.
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.
async Task< DataPortalResult > Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
Delete a business object.
Message sent to the WCF data portal.
string ClientCulture
Serialized client culture.
byte[] CriteriaData
Serialized data for the criteria object.
string TypeName
Assembly qualified name of the business object type to create.
byte[] GlobalContext
Serialized data for the global context object.
byte[] ClientContext
Serialized data for the client context object.
byte[] Principal
Serialized data for the principal object.
string ClientUICulture
Serialized client UI culture.
Message containing details about any server-side exception.
Response message for returning the results of a data portal call.
Request message for updating a business object.
byte[] GlobalContext
Serialized data for the global context object.
byte[] ClientContext
Serialized data for the client context object.
string ClientCulture
Serialized client culture.
byte[] ObjectData
Serialized object data.
string ClientUICulture
Serialized client UI culture.
byte[] Principal
Serialized data for the principal object.
Exposes server-side DataPortal functionality through HTTP request/response.
async Task< DataPortalResponse > Create(CriteriaRequest request)
Create and initialize an existing business object.
virtual DataPortalResponse ConvertResponse(DataPortalResponse response)
Override to convert the response data after it comes back from the network.
async Task< DataPortalResponse > Delete(CriteriaRequest request)
Delete a business object.
async Task< DataPortalResponse > Update(UpdateRequest request)
Update a business object.
virtual UpdateRequest ConvertRequest(UpdateRequest request)
Override to convert the request data before it is transferred over the network.
async Task< DataPortalResponse > Fetch(CriteriaRequest request)
Get an existing business object.
virtual CriteriaRequest ConvertRequest(CriteriaRequest request)
Override to convert the request data before it is transferred over the network.