private static object ReadServerResult(DataPortalResult result) { //同步服务端返回的统一的上下文,到本地的上下文对象中。 DistributionContext.SetGlobalContext(result.GlobalContext); return(result.ReturnObject); }
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; }