XmlSerializers created by XmlSerializer.FromType(new[] {typeof(...)})[0]; This prevents throwing an exception => better debugging.
This commit is contained in:
@@ -13,6 +13,9 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|
||||
{
|
||||
public class PMaxTestParams : TestParamsBase, IParamsProvider, ITestParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PMaxTestParams) })[0];
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public float PressureLo; /// Presure range low limit in [bar]
|
||||
public float PressureHi; /// Presure range high limit in [bar]
|
||||
public int DurationPMax; /// Duration of the test in [s]
|
||||
@@ -99,14 +102,13 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
PMaxTestParams tmp = (PMaxTestParams)(new XmlSerializer(typeof(PMaxTestParams)))
|
||||
.Deserialize(new StringReader(dbEntity.Parameters));
|
||||
PMaxTestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as PMaxTestParams;
|
||||
|
||||
testParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
test = dbEntity.Test;
|
||||
|
||||
tmp.CopyContentTo(this);
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user