/// <summary> /// IshObject creation through an IshField can (I think?!!) be done if you explicitly list all fields. /// </summary> /// <remarks>IshObject is typically only returned from the repository through an xml container.</remarks> /// <param name="ishType">Type indication, like ISHOutputFormat, ISHLibrary,...</param> /// <param name="ishRef">An element name, not that for some types this will be overwritten with a generated one</param> /// <param name="ishFields">The functions down the line will extract the required ishfields for real object creation.</param> public IshObject(Enumerations.ISHType ishType, string ishRef, IshFields ishFields) { _ishType = ishType; _ishRef = (ishRef == null) ? "" : ishRef; _objectRef = new Dictionary <Enumerations.ReferenceType, string>(); _ishFields = ishFields; _ishData = null; }
/// <summary> /// IshObject creation through an ishobject xml element. /// Incoming is: <ishobject ishref="D1E1030" ishtype="ISHModule" ishlogicalref="26288" ishversionref="26291" ishlngref="39490" /> /// </summary> /// <param name="xmlIshObject">One ishobject xml.</param> public IshObject(XmlElement xmlIshObject) { _ishType = (Enumerations.ISHType)Enum.Parse(typeof(Enumerations.ISHType), xmlIshObject.Attributes["ishtype"].Value); _ishRef = xmlIshObject.Attributes["ishref"].Value; _objectRef = new Dictionary <Enumerations.ReferenceType, string>(); StringEnum stringEnum = new StringEnum(typeof(Enumerations.ReferenceType)); // Loop all reference attributes present in the xml foreach (string refType in stringEnum.GetStringValues()) { if (xmlIshObject.HasAttribute(refType)) { Enumerations.ReferenceType enumValue = (Enumerations.ReferenceType)StringEnum.Parse(typeof(Enumerations.ReferenceType), refType); _objectRef.Add(enumValue, xmlIshObject.Attributes[refType].Value); } } _ishFields = new IshFields((XmlElement)xmlIshObject.SelectSingleNode("ishfields")); _ishData = new IshData((XmlElement)xmlIshObject.SelectSingleNode("ishdata")); }