Source/Csla/DataPortalClient/WcfProxy.cs
/// <summary>
/// Called by <see cref="DataPortal" /> to create a
/// new business object.
/// </summary>
/// <param name="objectType">Type of business object to create.</param>
/// <param name="criteria">Criteria object describing business object.</param>
/// <param name="context">
/// <see cref="Server.DataPortalContext" /> object passed to the server.
/// </param>
/// <param name="isSync">True if the client-side proxy should synchronously invoke the server.</param>
Called by  to create a
new business object.
Called by to create a new business object .
public async Task<DataPortalResult> Create(Type objectType, object criteria, DataPortalContext context, bool isSync)
    {
      ChannelFactory<IWcfPortal> cf = GetChannelFactory();
      var proxy = GetProxy(cf);
      WcfResponse response = null;
      try
      {
        var request = new CreateRequest(objectType, criteria, context);
        if (isSync)
          response = proxy.Create(request);
        else
          response = await proxy.CreateAsync(request);
        if (cf != null)
          cf.Close();
      }
      catch
      {
        cf.Abort();
        throw;
      }
      object result = response.Result;
      if (result is Exception)
        throw (Exception)result;
      return (DataPortalResult)result;
    }
public async Task < DataPortalResult > Create ( Type objectType , object criteria , DataPortalContext context , bool isSync ) { ChannelFactory < IWcfPortal > cf = GetChannelFactory ( ) ; var proxy = GetProxy ( cf ) ; WcfResponse response = null ; try { var request = new CreateRequest ( objectType , criteria , context ) ; if ( isSync ) response = proxy . Create ( request ) ; else response = await proxy . CreateAsync ( request ) ; if ( cf != null ) cf . Close ( ) ; } catch { cf . Abort ( ) ; throw ; } object result = response . Result ; if ( result is Exception ) throw ( Exception ) result ; return ( DataPortalResult ) result ; }
Called by  to create a
new business object.
Called by to create a new business object .
objectType
Type
Type of business object to create.
Type of business object to create .
criteria
object
Criteria object describing business object.
Criteria object describing business object .
context
DataPortalContext
object passed to the server.
object passed to the server .
isSync
bool
True if the client-side proxy should synchronously invoke the server.
True if the client - side proxy should synchronously invoke the server .