コード例 #1
0
        /// <summary>
        /// プロパティに列定義をバインドして取得する、バインド済みなら取得のみ行われる
        /// </summary>
        /// <param name="property">プロパティ情報</param>
        /// <param name="source">列を生成する基となった式</param>
        /// <returns></returns>
        Column BindColumn(PropertyInfo property, ElementCode source = null)
        {
            var column = this.ColumnMap.TryGetByPropertyName(property.Name);

            if (column != null)
            {
                return(column);
            }

            // もし型が Variable なら内部の値の型を取得する
            var type = property.PropertyType;

            if (source != null && typeof(Argument).IsAssignableFrom(type))
            {
                var variable = source.FindArguments().FirstOrDefault();
                if (!(variable is null) && variable.Value != null)
                {
                    type = variable.Value.GetType();
                }
            }

            // プロパティに列をバインド
            return(BindColumn(property.Name, "c" + this.ColumnMap.Count, this.Owner.Environment.CreateDbTypeFromType(type), 0, source));
        }