private static void SetContext(DataPortalContext context)
        {
            // set the app context to the value we got from the
            // client
            DistributionContext.SetClientContext(context.ClientContext);
            DistributionContext.SetGlobalContext(context.GlobalContext);

            // set the thread's culture to match the client
            Thread.CurrentThread.CurrentCulture   = new CultureInfo(context.ClientCulture);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(context.ClientUICulture);

            // We expect the some Principal object
            if (context.Principal == null)
            {
                System.Security.SecurityException ex =
                    new System.Security.SecurityException(
                        "Resources.BusinessPrincipalException" + " Nothing");
                ex.Action = System.Security.Permissions.SecurityAction.Demand;
                throw ex;
            }

            RafyEnvironment.Principal = context.Principal;
        }
 private static void ClearContext(DataPortalContext context)
 {
     DistributionContext.Clear();
     RafyEnvironment.Principal = null;
 }
Beispiel #3
0
        /// <summary>
        /// Update a business object.
        /// </summary>
        /// <param name="obj">Business object to update.</param>
        /// <param name="context">
        /// <see cref="DataPortalContext" /> object passed to the server.
        /// </param>
        public DataPortalResult Update(object obj, DataPortalContext context)
        {
            Update(obj);

            return(new DataPortalResult(obj));
        }