コード例 #1
0
        private void InitParameters <T>() where T : DbObject, new()
        {
            T local = Activator.CreateInstance <T>();

            FieldInfo[] fields    = DbObjectTools.GetFields(typeof(T));
            string      tableName = DbObjectTools.GetTableName(typeof(T));

            foreach (FieldInfo info in fields)
            {
                DbParameterAttribute[] customAttributes = (DbParameterAttribute[])info.GetCustomAttributes(typeof(DbParameterAttribute), true);
                if ((customAttributes != null) && (customAttributes.Length > 0))
                {
                    string name = info.Name;
                    object obj2 = info.GetValue(local) ?? "";
                    this.InitParameter(tableName, name, obj2);
                }
            }
        }