public object ConvertValue(TypeStorage type, object value) { m_holder1.ReadFrom(value); var srctype = m_holder1.GetFieldType(); if (srctype == type || srctype == TypeStorage.Null) { return(value); } ConvertValue(m_holder1, type, m_holder2); return(m_holder2.BoxTypedValue()); }
protected virtual void ApplyTypeRestrictions(BedValueHolder holder, DbTypeBase type, ILogger logger) { var stype = type as DbTypeString; var htype = holder.GetFieldType(); if (stype != null && htype == TypeStorage.String) { string sval = holder.GetString(); if (stype.Length > 0 && sval.Length > stype.Length) { sval = sval.Substring(0, stype.Length); holder.SetString(sval); } } if (htype.IsDateRelated() && !m_allowZeroInDate) { var dt = holder.GetDateTimeValue(); dt.MakeValidDate(); m_holder.SetDateTimeEx(dt); } }