예제 #1
0
        /// <summary>
        /// Constructs a new primitive store attribute with the given primitive type, column name and auto conversion option.
        /// </summary>
        /// <param name="primitive_type">The primitive type to store.</param>
        /// <param name="p_column_name">The name of the column to store the data in.</param>
        /// <param name="auto_convert">Whether the field this attribute is associated with should be automatically converted to the given primitive type.</param>
        /// <param name="store_options">Specifies how the data should be loaded.</param>
        public CPrimitiveAttribute(EDBPrimitive primitive_type, String p_column_name, Boolean auto_convert, EStoreOptions store_options)
        {
            switch (store_options)
            {
            case EStoreOptions.none:
                throw new ArgumentException("ELoadOptions.none is not a valid option.");

            case EStoreOptions.direct_assignment:
            case EStoreOptions.user_callback:
                break;

            default:
                throw new ArgumentException(store_options.ToString() + " is not a valid option.");
            }
            switch (primitive_type)
            {
            case EDBPrimitive.none:
                throw new ArgumentException("EDBPrimitive.none is not a valid primitive-type to store data with.");

            case EDBPrimitive.binary:
            case EDBPrimitive.bit:
            case EDBPrimitive.boolean:
            case EDBPrimitive.@char:
            case EDBPrimitive.@decimal:
            case EDBPrimitive.@double:
            case EDBPrimitive.@float:
            case EDBPrimitive.int16:
            case EDBPrimitive.int24:
            case EDBPrimitive.int32:
            case EDBPrimitive.int64:
            case EDBPrimitive.int8:
            case EDBPrimitive.uint16:
            case EDBPrimitive.uint24:
            case EDBPrimitive.uint32:
            case EDBPrimitive.uint64:
            case EDBPrimitive.uint8:
            case EDBPrimitive.varbinary:
            case EDBPrimitive.varchar:
            case EDBPrimitive.date:
            case EDBPrimitive.datetime:
            case EDBPrimitive.time:
            case EDBPrimitive.timestamp:
            case EDBPrimitive.year:
            case EDBPrimitive.text:
            case EDBPrimitive.infer:
                break;

            default:
                throw new ArgumentException(primitive_type.ToString() + " is not a valid primitive-type to store data with.");
            }

            m_primitive_type = primitive_type;
            m_p_column_name  = p_column_name;
            m_auto_convert   = auto_convert;
            m_store_options  = store_options;
        }
예제 #2
0
 /// <summary>
 /// Constructs new primitive store options with the given settings.
 /// </summary>
 /// <param name="p_column_name">The name of the column in the table.</param>
 /// <param name="primitive_type">The type of the database primitive.</param>
 /// <param name="p_field">The field holding the value that maps to the primitive.</param>
 /// <param name="load_options">Specified the way the primitive data should be loaded.</param>
 internal SStorePrimitiveOptions(String p_column_name, EDBPrimitive primitive_type, FieldInfo p_field, MethodInfo p_method, Boolean auto_convert, EStoreOptions load_options)
     : this()
 {
     m_p_column_name  = p_column_name;
     m_auto_convert   = auto_convert;
     m_primitive_type = primitive_type;
     m_p_field        = p_field;
     m_p_method       = p_method;
     m_store_options  = load_options;
     m_is_identity    = false;
 }
예제 #3
0
 /// <summary>
 /// Constructs a new primitive store attribute with the given primitive type, column name and auto conversion option.
 /// </summary>
 /// <param name="primitive_type">The primitive type to store.</param>
 /// <param name="p_column_name">The name of the column to store the data in.</param>
 /// <param name="store_options">Specifies how the data should be loaded.</param>
 public CPrimitiveAttribute(EDBPrimitive primitive_type, String p_column_name, EStoreOptions store_options)
     : this(primitive_type, p_column_name, true, store_options)
 {
 }