/// <summary> /// Initializes a new root of the <see cref="CSF.Zpt.Rendering.Model"/> class. /// </summary> /// <param name="options">Keyword options.</param> /// <param name="modelObject">The model to be rendered.</param> public Model(NamedObjectWrapper options, object modelObject = null) { _options = options?? new NamedObjectWrapper(); _parent = null; _root = this; this.LocalDefinitions = new Dictionary<string, object>(); _globalDefinitions = (_root == this)? new Dictionary<string,object>() : null; this.ModelObject = modelObject; }
/// <summary> /// Initializes a new instance of the <see cref="CSF.Zpt.Rendering.Model"/> class. /// </summary> /// <param name="parent">A reference to the parent model instance, if applicable.</param> /// <param name="root">A reference to the root of the model hierarchy.</param> /// <param name="modelObject">The model to be rendered.</param> public Model(IModel parent, IModel root, object modelObject = null) { if(root == null) { throw new ArgumentNullException(nameof(root)); } _parent = (Model) parent; _root = (Model) root; this.LocalDefinitions = new Dictionary<string, object>(); _globalDefinitions = (_root == this)? new Dictionary<string,object>() : null; this.ModelObject = modelObject; }