Fetch() 공개 메소드

Get an existing business object.
public Fetch ( Type objectType, object criteria, Csla.Server.DataPortalContext context, bool isSync ) : Task
objectType System.Type Type of business object to retrieve.
criteria object Criteria object describing business object.
context Csla.Server.DataPortalContext /// object passed to the server. ///
isSync bool True if the client-side proxy should synchronously invoke the server.
리턴 Task
예제 #1
0
 /// <summary>
 /// Get 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)
 {
     try
     {
         context.FactoryInfo = ObjectFactoryAttribute.GetObjectFactoryAttribute(objectType);
         if (context.FactoryInfo == null)
         {
             var dp = new SimpleDataPortal();
             return(dp.Fetch(objectType, criteria, context));
         }
         else
         {
             var dp = new FactoryDataPortal();
             return(dp.Fetch(objectType, criteria, context));
         }
     }
     catch (DataPortalException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw new DataPortalException(
                   "DataPortal.Fetch " + Resources.FailedOnServer,
                   ex, new DataPortalResult());
     }
 }
예제 #2
0
 /// <summary>
 /// Get 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>
 /// <param name="isSync">True if the client-side proxy should synchronously invoke the server.</param>
 public async Task <DataPortalResult> Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
 {
     try
     {
         context.FactoryInfo = ObjectFactoryAttribute.GetObjectFactoryAttribute(objectType);
         if (context.FactoryInfo == null)
         {
             var dp = new SimpleDataPortal();
             return(await dp.Fetch(objectType, criteria, context, isSync).ConfigureAwait(false));
         }
         else
         {
             var dp = new FactoryDataPortal();
             return(await dp.Fetch(objectType, criteria, context, isSync).ConfigureAwait(false));
         }
     }
     catch (DataPortalException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw DataPortal.NewDataPortalException(
                   "DataPortal.Fetch " + Resources.FailedOnServer,
                   ex, null);
     }
 }
예제 #3
0
 /// <summary>
 /// Get 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>
 /// <param name="isSync">True if the client-side proxy should synchronously invoke the server.</param>
 public async Task<DataPortalResult> Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
 {
   try
   {
     context.FactoryInfo = ObjectFactoryAttribute.GetObjectFactoryAttribute(objectType);
     if (context.FactoryInfo == null)
     {
       var dp = new SimpleDataPortal();
       return await dp.Fetch(objectType, criteria, context, isSync);
     }
     else
     {
       var dp = new FactoryDataPortal();
       return await dp.Fetch(objectType, criteria, context, isSync);
     }
   }
   catch (DataPortalException)
   {
     throw;
   }
   catch (Exception ex)
   {
     throw DataPortal.NewDataPortalException(
       "DataPortal.Fetch " + Resources.FailedOnServer,
       ex, null);
   }
 }