using System.Xml.Linq;
using Vrh.XmlProcessing;
namespace Vrh.OneReport
{
public class PluginDescriptor : XmlLinqBase
{
#region AttributeNames static class
///
/// Az XML fájlban ilyen attribútum nevek találhatóak egy "Output" elemben.
///
public static class AttributeNames
{
///
/// 'Name' attribútum név a 'Plugin' elemben.
///
public const string ID = "Id";
///
/// 'Type' attribútum név a 'Plugin' elemben.
///
public const string TYPE = "Type";
///
/// 'ConnectionString' attribútum név a 'Dataset' elemben.
///
public const string CONNECTIONSTRING = "ConnectionString";
///
/// 'PluginAssemblyPath' attribútum név.
///
public const string PLUGINASSEMBLYPATH = "PluginAssemblyPath";
///
/// 'PluginMethodName' attribútum név.
///
public const string PLUGINMETHODNAME = "PluginMethodName";
///
/// 'PluginTypeFullName' attribútum név.
///
public const string PLUGINTYPE = "PluginTypeFullName";
///
/// 'PluginTypeFullName' attribútum név.
///
public const string PLUGINXML = "PluginXml";
}
#endregion AttributeNames static class
public PluginDescriptor(XElement xelement)
{
if (xelement != null)
{
this.Id = GetValue(xelement.Attribute(AttributeNames.ID), "");
this.Type = GetEnumValue(xelement.Attribute(AttributeNames.TYPE), PluginTypes.DataPlugin);
this.PluginAssemblyPath = GetValue(xelement.Attribute(AttributeNames.PLUGINASSEMBLYPATH), "");
this.PluginMethodName = GetValue(xelement.Attribute(AttributeNames.PLUGINMETHODNAME),"");
this.PluginTypeFullName = GetValue(xelement.Attribute(AttributeNames.PLUGINTYPE),"");
this.PluginAssemblyXml= GetValue(xelement.Attribute(AttributeNames.PLUGINXML), "");
this.ConnectionString = ConnectionStringStore.Get(GetValue(xelement.Attribute(AttributeNames.CONNECTIONSTRING), ""));
}
}
///
/// A plugin neve
///
public string Id { get; set; }
///
/// Az adatforrás plugin típusa
///
public PluginTypes Type { get; set; }
///
/// Az adatforráshoz tartozó connectionstring
///
public string ConnectionString { get; set; }
///
/// Plugin típus esetén a megvalósító plugin
///
public string PluginAssemblyPath { get; set; }
///
/// Plugin típus esetén a típus teljes neve
///
public string PluginTypeFullName { get; set; }
///
/// Plugin típus esetén az elérendő metódus név
///
public string PluginMethodName { get; set; }
///
/// Plugin típus esetén a meghívandó metódusnak átadandó xml paraméter struktúrára mutató xml sonnectionstring
///
public string PluginAssemblyXml { get; set; }
}
}