Exemplo n.º 1
0
        public static void Delete(object criteria)
        {
            Server.DataPortalResult result;

            MethodInfo method = MethodCaller.GetMethod(
                MethodCaller.GetObjectType(criteria), "DataPortal_Delete", criteria);

            DataPortalClient.IDataPortalProxy proxy;
            proxy = GetDataPortalProxy(RunLocal(method));

            Server.DataPortalContext dpContext = new Server.DataPortalContext(GetPrincipal(), proxy.IsServerRemote);

            OnDataPortalInvoke(new DataPortalEventArgs(dpContext));

            try
            {
                result = proxy.Delete(criteria, dpContext);
            }
            catch (Server.DataPortalException ex)
            {
                result = ex.Result;
                if (proxy.IsServerRemote)
                {
                    ApplicationContext.SetGlobalContext(result.GlobalContext);
                }
                throw new DataPortalException("DataPortal.Delete " + Resources.Failed, ex.InnerException, result.ReturnObject);
            }

            if (proxy.IsServerRemote)
            {
                ApplicationContext.SetGlobalContext(result.GlobalContext);
            }

            OnDataPortalInvokeComplete(new DataPortalEventArgs(dpContext));
        }
Exemplo n.º 2
0
 public static object Create(object criteria)
 {
     return(Create(MethodCaller.GetObjectType(criteria), criteria));
 }