private void ResolveAttributes(XContainer container, XmlElement xmlElement)
{
if (xmlElement != null)
{
foreach (IXAttribute attribute in container.Attributes)
{
string value = xmlElement.GetAttribute(attribute.Name);
if (!string.IsNullOrEmpty(value))
{
if (attribute is XAttribute<string>)
{
((XAttribute<string>)attribute).Value = value;
}
else if (attribute is XAttribute<int>)
{
((XAttribute<int>)attribute).Value = int.Parse(value);
}
else if (attribute is XAttribute<bool>)
{
((XAttribute<bool>)attribute).Value = bool.Parse(value);
}
else if (attribute is XAttribute<DateTime>)
{
((XAttribute<DateTime>)attribute).Value = DateTime.Parse(value);
}
else if (attribute is XEnumerationAttribute<string>)
{
((XEnumerationAttribute<string>)attribute).Value = value;
}
}
}
}
}