コード例 #1
0
        /// <summary>
        /// Constructs a new store many to many attribute linking many source objects to many destination objects using the given columns.
        /// </summary>
        /// <param name="p_value_name">The value name to identify the callback that handles the loaded data.</param>
        /// <param name="p_relation_table">The relation table to use for linking the objects.</param>
        public CManyToManyAttribute(String p_value_name, String p_source_column, String p_target_column, String p_relation_table)
        {
            if (p_value_name == null)
            {
                throw new ArgumentNullException("The value name may not be null.");
            }
            m_p_value_name = p_value_name;

            if (p_source_column == null || p_target_column == null)
            {
                throw new ArgumentNullException("Neither the source column nor the target column may be null. Consider constructing only with a relation table given instead.");
            }
            if (p_source_column == p_target_column)
            {
                throw new ArgumentException("The names of the source and target column may not be the same.");
            }
            if (p_source_column.Length == 0 || p_target_column.Length == 0)
            {
                throw new ArgumentException("Neither the name of the source column nor the name of the target column may be empty strings.");
            }
            if (p_relation_table == null)
            {
                throw new ArgumentNullException("The relation table may not be null");
            }
            if (p_relation_table.Length == 0)
            {
                throw new ArgumentException("Please specify at least one character for the name of the relation table.");
            }


            m_p_source_to_relation_link = new CForeignKey(null, p_source_column, p_relation_table, p_source_column);
            m_p_relation_to_target_link = new CForeignKey(p_relation_table, p_target_column, null, p_target_column);
        }
コード例 #2
0
        /// <summary>
        /// Constructs a new store one to many attribute linking the one to the many on the given columns present in both tables.
        /// </summary>
        /// <param name="p_linked_column_names">The columns to link on that are present in both tables.</param>
        public COneToManyAttribute(String p_value_name, String[] p_linked_column_names)
        {
            if (p_value_name == null)
            {
                throw new ArgumentNullException("The value name may not be null.");
            }
            m_p_value_name = p_value_name;

            m_p_linked_columns = new CForeignKey(
                null, p_linked_column_names,
                null, p_linked_column_names
                );
        }
コード例 #3
0
        /// <summary>
        /// Constructs a new store one to many attribute linking the one to the many on the given column present in both tables.
        /// </summary>
        /// <param name="p_source_column_name">The column to link on that is present in the source table.</param>
        /// <param name="p_target_column_name">The column to link on that is present in the target table.</param>
        /// <param name="p_target_type">The type that determines what tables are linked.</param>
        public COneToManyAttribute(String p_value_name, String p_source_column_name, String p_target_column_name, Type p_target_type)
        {
            if (p_value_name == null)
            {
                throw new ArgumentNullException("The value name may not be null.");
            }
            m_p_value_name  = p_value_name;
            m_p_target_type = p_target_type;

            m_p_linked_columns = new CForeignKey(
                null, p_source_column_name,
                null, p_target_column_name
                );
        }
コード例 #4
0
        /// <summary>
        /// Constructs a new store many to many attribute linking many source objects to many destination objects using the primary keys and tables defined through attributes on the relevant types as well as the given relation table.
        /// </summary>
        /// <param name="p_value_name">The value name to identify the callback that handles the loaded data.</param>
        /// <param name="p_relation_table">The relation table to use for linking the objects.</param>
        public CManyToManyAttribute(String p_value_name, String p_relation_table)
        {
            if (p_value_name == null)
            {
                throw new ArgumentNullException("The value name may not be null.");
            }
            m_p_value_name = p_value_name;

            if (p_relation_table == null)
            {
                throw new ArgumentNullException("The relation table may not be null");
            }
            if (p_relation_table.Length == 0)
            {
                throw new ArgumentException("Please specify at least one character for the name of the relation table.");
            }

            // null data will be filled in by attribute processors
            m_p_source_to_relation_link = new CForeignKey(null, (String)null, p_relation_table, (String)null);
            m_p_relation_to_target_link = new CForeignKey(p_relation_table, (String)null, null, (String)null);
        }