public virtual object BuildOneInstance(AtomicNativeObjectInfo objectInfo) { int odbTypeId = objectInfo.GetOdbTypeId(); long l = -1; switch (odbTypeId) { case ODBType.NullId: { return(null); } case ODBType.StringId: { return(objectInfo.GetObject()); } case ODBType.DateId: { return(objectInfo.GetObject()); } case ODBType.LongId: case ODBType.NativeLongId: { if (objectInfo.GetObject().GetType() == typeof(System.Int64)) { return(objectInfo.GetObject()); } return(System.Convert.ToInt64(objectInfo.GetObject().ToString())); } case ODBType.IntegerId: case ODBType.NativeIntId: { if (objectInfo.GetObject().GetType() == typeof(int)) { return(objectInfo.GetObject()); } return(System.Convert.ToInt32(objectInfo.GetObject().ToString())); } case ODBType.BooleanId: case ODBType.NativeBooleanId: { if (objectInfo.GetObject().GetType() == typeof(bool)) { return(objectInfo.GetObject()); } return(System.Convert.ToBoolean(objectInfo.GetObject().ToString())); } case ODBType.ByteId: case ODBType.NativeByteId: { if (objectInfo.GetObject().GetType() == typeof(byte)) { return(objectInfo.GetObject()); } return(System.Convert.ToByte(objectInfo.GetObject().ToString())); } case ODBType.ShortId: case ODBType.NativeShortId: { if (objectInfo.GetObject().GetType() == typeof(short)) { return(objectInfo.GetObject()); } return(System.Convert.ToInt16(objectInfo.GetObject().ToString())); } case ODBType.FloatId: case ODBType.NativeFloatId: { if (objectInfo.GetObject().GetType() == typeof(float)) { return(objectInfo.GetObject()); } return(System.Convert.ToSingle(objectInfo.GetObject().ToString())); } case ODBType.DoubleId: case ODBType.NativeDoubleId: { if (objectInfo.GetObject().GetType() == typeof(double)) { return(objectInfo.GetObject()); } return(System.Convert.ToDouble(objectInfo.GetObject().ToString())); } case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BigDecimalId: { return(System.Decimal.Parse(objectInfo.GetObject().ToString(), System.Globalization.NumberStyles.Any)); } case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BigIntegerId: { return(System.Decimal.Parse(objectInfo.GetObject().ToString(), System.Globalization.NumberStyles.Any)); } case ODBType.CharacterId: case ODBType.NativeCharId: { if (objectInfo.GetObject().GetType() == typeof(char)) { return(objectInfo.GetObject()); } return(objectInfo.GetObject().ToString()[0]); } case ODBType.ObjectOidId: { if (objectInfo.GetObject().GetType() == typeof(long)) { l = (long)objectInfo.GetObject(); } else { OID oid = (OID)objectInfo.GetObject(); l = oid.GetObjectId(); } return(OIDFactory.BuildObjectOID(l)); } case ODBType.ClassOidId: { if (objectInfo.GetObject().GetType() == typeof(long)) { l = (long)objectInfo.GetObject(); } else { l = System.Convert.ToInt64(objectInfo.GetObject().ToString()); } return(OIDFactory.BuildClassOID(l)); } default: { throw new ODBRuntimeException(NeoDatisError.InstanceBuilderNativeTypeInCollectionNotSupported .AddParameter(ODBType.GetNameFromId(odbTypeId))); break; } } }