public static XMLAdapter.AdapterType Value(object obj, XMLAdapter.AdapterType defaultValue) { try { if (Convert.IsDBNull(obj) || obj.ToString().Contains("NULL")) { return(defaultValue); } else { XMLAdapter.AdapterType type; if (!Enum.TryParse(Convert.ToString(obj), true, out type)) { if (Convert.ToString(obj).Equals("proprietary", StringComparison.InvariantCultureIgnoreCase)) { return(XMLAdapter.AdapterType.TDS); } return(defaultValue); } else { return(type); } } } catch { return(defaultValue); } }
internal XmlDocument ToXml(string group, ITestResultSerializerFactory serializerFactory) { XmlDocument doc = new XmlDocument(); //Check Metadata for xml serializer type, TDS is default value MetaDataEntry entry = ServiceLocator.Resolve <ConfigurationHolder>().GetFromMetaData(this.ProjectID, group, "XMLVersion"); XMLAdapter.AdapterType xmlType = XMLAdapter.AdapterType.TDS; if (entry != null) { xmlType = Utilities.Utility.Value(entry.TextVal, XMLAdapter.AdapterType.TDS); } // if set to 1/true, any demographics in the file will be preserved // Used only in the OSS environment to minimize configuration entry = ServiceLocator.Resolve <ConfigurationHolder>().GetFromMetaData(this.ProjectID, group, "IncludeAllDemographics"); SerializationConfig config = null; if (entry != null && Convert.ToBoolean(entry.IntVal)) { config = new SerializationConfigIncludeAllDemographics(); } else { //get the serialization config from the project metadata config = new SerializationConfig(/*ConfigurationHolder.IncludeAccommodations(ProjectID, group),*/ ServiceLocator.Resolve <ConfigurationHolder>().GetRTSAttributes(this.projectID, group)); } doc.LoadXml(serializerFactory.CreateSerializer(xmlType.ToString(), this).Serialize(config)); return(doc); }
public RESTTarget(string targetName, TargetClass targetClass, TargetType type, XMLAdapter.AdapterType xmlVersion, FileTransformSpec transformSpec) : base(targetName, targetClass, type, xmlVersion, transformSpec) { }
public ItemScoringTarget(string targetName, TargetClass targetClass, TargetType type, XMLAdapter.AdapterType xmlVersion, FileTransformSpec transformSpec, IFileTransformArgs transformArgs) : base(targetName, targetClass, type, xmlVersion, transformSpec, transformArgs) { }
protected Target(string targetName, TargetClass targetClass, TargetType type, XMLAdapter.AdapterType xmlVersion, FileTransformSpec transformSpec) : this(targetName, targetClass, type, xmlVersion, transformSpec, new NoFileTransformArgs()) { }
protected Target(string targetName, TargetClass targetClass, TargetType type, XMLAdapter.AdapterType xmlVersion, FileTransformSpec transformSpec, IFileTransformArgs transformArgs) { this.Name = targetName; this.Type = type; this.Class = targetClass; this.XmlVersion = xmlVersion; this.TransformSpec = transformSpec; this.TransformArgs = transformArgs ?? new NoFileTransformArgs(); }