33 lines
734 B
C#
33 lines
734 B
C#
using System;
|
|
using System.Xml;
|
|
using System.Globalization;
|
|
|
|
namespace oodb.mapping
|
|
{
|
|
public class IntegerMapping : NaiveMapping
|
|
{
|
|
public IntegerMapping(OODB oodb)
|
|
: base(oodb, typeof(int))
|
|
{
|
|
}
|
|
|
|
public override object FromText(String text)
|
|
{
|
|
int iValue = int.Parse(text, CultureInfo.InvariantCulture);
|
|
if (NativeType != typeof(int))
|
|
{
|
|
return Convert.ChangeType(iValue, NativeType);
|
|
}
|
|
return iValue;
|
|
}
|
|
|
|
public override string ToText(object value)
|
|
{
|
|
int iValue = (int)value;
|
|
return iValue.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
}
|
|
|
|
}
|
|
|