Methods CreateDbEntity and CreateFromDbEntity moved from XyzCfg to ComponentCfgBase, factories modified accordingly.
This commit is contained in:
@@ -7,48 +7,22 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
{
|
||||
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
/// Parameterless constructor
|
||||
public PrinterCfg()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic results printer configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">BasicPrinter factory</param>
|
||||
/// <param name="name">Printer name</param>
|
||||
public PrinterCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
/// Parameterless constructor
|
||||
public PrinterCfg()
|
||||
{
|
||||
}
|
||||
Name = "PrintedProtocol";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new PrinterCfg(Factory, Name);
|
||||
}
|
||||
public PrinterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
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))
|
||||
{
|
||||
PrinterCfg config = (PrinterCfg)(new XmlSerializer(typeof(PrinterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new PrinterCfg(this, "PrintedProtocol");
|
||||
return new PrinterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return PrinterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
|
||||
|
||||
Reference in New Issue
Block a user