Methods CreateDbEntity and CreateFromDbEntity moved from XyzCfg to ComponentCfgBase, factories modified accordingly.
This commit is contained in:
@@ -10,45 +10,19 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
/// Parameterless constructor
|
||||
public WriterCfg()
|
||||
{
|
||||
}
|
||||
Name = "BasicResultsWriter";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic results printer configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">BasicPrinter factory</param>
|
||||
/// <param name="name">Printer name</param>
|
||||
public WriterCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public WriterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new WriterCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
WriterCfg config = (WriterCfg)(new XmlSerializer(typeof(WriterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new WriterCfg(this, "BasicResultsWriter");
|
||||
return new WriterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return WriterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Writer.ResetStaticProperties(); }
|
||||
|
||||
Reference in New Issue
Block a user