10using System.Threading.Tasks;
22 #region Factory Loader
36 if (_factoryLoader ==
null)
38 string setting = ConfigurationManager.AppSettings[
"CslaObjectFactoryLoader"];
39 if (!
string.IsNullOrEmpty(setting))
45 return _factoryLoader;
49 _factoryLoader = value;
55 #region Method invokes
66 Utilities.ThrowIfAsyncMethodOnSyncClient(isSync, factory, methodName);
69 var error = result as Exception;
74 if (busy !=
null && busy.IsBusy)
75 throw new InvalidOperationException(
string.Format(
"{0}.IsBusy == true", objectType.Name));
85 return new DataPortalResult(result);
88 private async Task<DataPortalResult> InvokeMethod(
string factoryTypeName,
DataPortalOperations operation,
string methodName, Type objectType,
object e, DataPortalContext context,
bool isSync)
91 var eventArgs =
new DataPortalEventArgs(context, objectType, e, operation);
97 Utilities.ThrowIfAsyncMethodOnSyncClient(isSync, factory, methodName, e);
100 var error = result as Exception;
105 if (busy !=
null && busy.IsBusy)
106 throw new InvalidOperationException(
string.Format(
"{0}.IsBusy == true", objectType.Name));
112 Csla.
Reflection.
MethodCaller.CallMethodIfImplemented(factory,
"InvokeError",
new DataPortalEventArgs(context, objectType, e, operation, ex));
115 return new DataPortalResult(result);
120 #region IDataPortalServer Members
190 string methodName =
string.Empty;
194 if (obj is Core.ICommandObject)
Provides information about the DataPortal call.
A strongly-typed resource class, for looking up localized strings, etc.
static string FailedOnServer
Looks up a localized string similar to failed on the server.
Provides consistent context information between the client and server DataPortal objects.
ObjectFactoryAttribute FactoryInfo
Gets the current ObjectFactory attribute value (if any).
This class provides a hoook for developers to add custom error handling in the DataPortal.
Implements the server-side DataPortal message router as discussed in Chapter 4.
Returns data from the server-side DataPortal to the client-side DataPortal.
Empty criteria used by the data portal as a placeholder for a create/fetch request that has no criter...
Server-side data portal implementation that invokes an object factory rather than directly interactin...
async Task< DataPortalResult > Update(object obj, DataPortalContext context, bool isSync)
Update a business object.
async Task< DataPortalResult > Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
Get an existing business object.
async Task< DataPortalResult > Delete(Type objectType, object criteria, DataPortalContext context, bool isSync)
Delete a business object.
static IObjectFactoryLoader FactoryLoader
Gets or sets a delegate reference to the method called to create instances of factory objects as requ...
async Task< DataPortalResult > Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
Create a new business object.
string FetchMethodName
Name of the method to call for a fetch operation.
string DeleteMethodName
Name of the method to call for a delete operation.
string ExecuteMethodName
Name of the method to call for a Execute operation.
string UpdateMethodName
Name of the method to call for a update operation.
string CreateMethodName
Name of the method to call for a create operation.
string FactoryTypeName
Assembly qualified type name of the factory object.
Class containing the default implementation for the FactoryLoader delegate used by the data portal ho...
Defines the common properties required objects that track their own status.
Interface implemented by server-side data portal components.
Defines an interface to be implemented by a factory loader object that returns ObjectFactory objects ...
object GetFactory(string factoryName)
Returns an ObjectFactory object.
DataPortalOperations
List of data portal operations.