public static NovaBoxedInstance Box(object obj, NovaScope scope = null) { if (obj == null) { return(null); } if (_boxCache.ContainsKey(obj)) { _boxCache[obj].BoxedScope.MergeWithScope(scope ?? new NovaScope()); return(_boxCache[obj]); } var boxed = new NovaBoxedInstance(obj, scope ?? new NovaScope()); _boxCache[obj] = boxed; if (scope != null) { string name; var _scope = scope.SearchForObject(obj, out name); if (_scope != null) { _scope[name] = boxed; } } return(boxed); }
public static NovaBoxedInstance BoxNoCache(object obj, NovaScope scope = null) { if (obj == null) { return(null); } var boxed = new NovaBoxedInstance(obj, scope ?? new NovaScope()); if (scope != null) { string name; var _scope = scope.SearchForObject(obj, out name); if (_scope != null) { _scope[name] = boxed; } } return(boxed); }