コード例 #1
0
        /// <summary>
        /// Bind insert value
        /// </summary>
        public static void BindInsert(this IDbStatement me, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            var mapping = OpenIZ.Core.Data.QueryBuilder.TableMapping.Get(value.GetType());

            object[] values = new object[mapping.Columns.Count()];
            int      idx    = 0;

            // Bind the insert columns
            foreach (var col in mapping.Columns)
            {
                values[idx++] = col.SourceProperty.GetValue(value);
            }

            me.BindParameters(values);
        }