83 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using Csla.Server;
 | 
						|
 | 
						|
namespace Csla.DataPortalClient
 | 
						|
{
 | 
						|
  /// <summary>
 | 
						|
  /// Implements a data portal proxy to relay data portal
 | 
						|
  /// calls to an application server hosted locally 
 | 
						|
  /// in the client process and AppDomain.
 | 
						|
  /// </summary>
 | 
						|
  public class LocalProxy : DataPortalClient.IDataPortalProxy
 | 
						|
  {
 | 
						|
    private Server.IDataPortalServer _portal =
 | 
						|
      new Server.DataPortal();
 | 
						|
 | 
						|
    /// <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>
 | 
						|
    public DataPortalResult Create(
 | 
						|
      Type objectType, object criteria, DataPortalContext context)
 | 
						|
    {
 | 
						|
      return _portal.Create(objectType, criteria, context);
 | 
						|
    }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Called by <see cref="DataPortal" /> to load an
 | 
						|
    /// existing business object.
 | 
						|
    /// </summary>
 | 
						|
    /// <param name="objectType">Type of business object to retrieve.</param>
 | 
						|
    /// <param name="criteria">Criteria object describing business object.</param>
 | 
						|
    /// <param name="context">
 | 
						|
    /// <see cref="Server.DataPortalContext" /> object passed to the server.
 | 
						|
    /// </param>
 | 
						|
    public DataPortalResult Fetch(Type objectType, object criteria, DataPortalContext context)
 | 
						|
    {
 | 
						|
      return _portal.Fetch(objectType, criteria, context);
 | 
						|
    }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Called by <see cref="DataPortal" /> to update a
 | 
						|
    /// business object.
 | 
						|
    /// </summary>
 | 
						|
    /// <param name="obj">The business object to update.</param>
 | 
						|
    /// <param name="context">
 | 
						|
    /// <see cref="Server.DataPortalContext" /> object passed to the server.
 | 
						|
    /// </param>
 | 
						|
    public DataPortalResult Update(object obj, DataPortalContext context)
 | 
						|
    {
 | 
						|
      return _portal.Update(obj, context);
 | 
						|
    }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Called by <see cref="DataPortal" /> to delete a
 | 
						|
    /// business object.
 | 
						|
    /// </summary>
 | 
						|
    /// <param name="criteria">Criteria object describing business object.</param>
 | 
						|
    /// <param name="context">
 | 
						|
    /// <see cref="Server.DataPortalContext" /> object passed to the server.
 | 
						|
    /// </param>
 | 
						|
    public DataPortalResult Delete(object criteria, DataPortalContext context)
 | 
						|
    {
 | 
						|
      return _portal.Delete(criteria, context);
 | 
						|
    }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Get a value indicating whether this proxy will invoke
 | 
						|
    /// a remote data portal server, or run the "server-side"
 | 
						|
    /// data portal in the caller's process and AppDomain.
 | 
						|
    /// </summary>
 | 
						|
    public bool IsServerRemote
 | 
						|
    {
 | 
						|
      get { return false; }
 | 
						|
    }
 | 
						|
 | 
						|
  }
 | 
						|
}
 |