/** * Methods */ /// <summary> /// Initializes a new instance of the <see cref="XmlResource"/> class. /// </summary> public XmlResource() { this.sourceFile = string.Empty; // generate a blank dataset schema set = new XmlDataSet(); }
/// <summary> /// Initializes a new instance of the <see cref="XmlResource"/> class. /// </summary> /// <param name="set"></param> public XmlResource(XmlDataSet set) { // generate a blank dataset schema this.set = new XmlDataSet(); // clone the dataset this.set.Clone(set); }
/// <summary> /// Initializes a new instance of the <see cref="XmlResource"/> class. /// </summary> /// <param name="fileName"></param> public XmlResource(string fileName) { // generate a blank dataset schema set = new XmlDataSet(); this.sourceFile = fileName; FileStream onDiskData = File.Open(fileName, FileMode.Open, FileAccess.Read); if (onDiskData != null) { if (onDiskData.CanRead) { onDiskData.Position = 0; // deserialize data out from the database file set.DataSet.ReadXml(new StreamReader(onDiskData), XmlReadMode.ReadSchema); ParseInclude(); } onDiskData.Close(); } }
/// <summary> /// Merge a separate <see cref="XmlDataSet"/> into this <see cref="XmlDataSet"/>. /// </summary> /// <param name="set"></param> public void Merge(XmlDataSet set) { this.set.Merge(set.DataSet); }
/// <summary> /// Clones (both schema and data) the given <see cref="XmlDataSet"/> into this set. /// </summary> /// <param name="set"></param> public void Clone(XmlDataSet set) { this.set = set.DataSet.Clone(); this.set.Merge(set.DataSet); }