This commit is contained in:
2011-05-19 13:26:37 +00:00
parent c6821188c5
commit 4405463e8e
4 changed files with 116 additions and 75 deletions

View File

@@ -369,6 +369,15 @@ namespace VEPROMS.CSLA.Library
}
return ll.Value;
}
public float? LazyLoad(ref LazyLoad<float?> ll, string xPath)
{
if (ll == null)
{
XmlNode xn = SelectSingleNode(xPath);
ll = new LazyLoad<float?>(RetrieveFloat(xPath, xn));
}
return ll.Value;
}
protected int? RetrieveInt(string xPath, XmlNode xn)
{
int? value = null;
@@ -384,6 +393,21 @@ namespace VEPROMS.CSLA.Library
}
return value;
}
protected float? RetrieveFloat(string xPath, XmlNode xn)
{
float? value = null;
if (xn != null)
{
float fValue = 0;
if (!float.TryParse(xn.InnerText, out fValue))
{
Console.WriteLine(string.Format("'{0}'\r\n'{1}'\r\n'{2}' could not be converted to float?", MyFormat.FullName, MyPath + "/" + xPath, xn.InnerText));
throw (new Exception(string.Format("{0} = '{1}' could not be converted to float?", xPath, xn.InnerText)));
}
value = fValue;
}
return value;
}
public Nullable<T> LazyLoad<T>(ref LazyLoad<Nullable<T>> ll, string xPath)
where T:struct
{