Esempio n. 1
0
        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;
        }