internal static Context CreateNewContext(IConstructionCallMessage msg)
{
// Create the new context
Context newContext = new Context();
foreach (IContextProperty prop in msg.ContextProperties)
{
if (newContext.GetProperty(prop.Name) == null)
{
newContext.SetProperty(prop);
}
}
newContext.Freeze();
// Ask each context property whether the new context is OK
foreach (IContextProperty prop in msg.ContextProperties)
{
if (!prop.IsNewContextOK(newContext))
{
throw new RemotingException("A context property did not approve the candidate context for activating the object");
}
}
return(newContext);
}