void OnSerializing(StreamingContext context) { IPersistDynamicNode persist = _convert as IPersistDynamicNode; if (persist != null) { _state = persist.GetState(GetLogger()); } // Intern strings so they all end up with the same reference this massively improves data usage // really should be doing this at a container level, but oh well. _script = String.Intern(_script); _engine = String.Intern(_engine); _classname = String.Intern(_classname); }
void OnSerializing(StreamingContext context) { if (_convert != null) { IPersistDynamicNode persist = _convert as IPersistDynamicNode; if (persist != null) { _state = persist.GetState(GetLogger()); } } _script = String.Intern(_script); _engine = String.Intern(_engine); _classname = String.Intern(_classname); }
private IDataStreamParser CreateConverter() { if (_convert == null) { ScriptContainer container = new ScriptContainer(_engine, Guid.Empty, _script, _enableDebug, _referencedAssemblies.Select(a => a.GetName())); _convert = (IDataStreamParser)ScriptUtils.GetInstance(container, _classname); if (_state != null) { IPersistDynamicNode persist = _convert as IPersistDynamicNode; if (persist != null) { persist.SetState(_state, GetLogger()); } } } return(_convert); }