private void AppendProperties() { sb.AppendLine(" #region Properties"); sb.AppendLine(); foreach (var column in _item.GetColumns().Where(x => x.Generated).OrderBy(x => x.Name)) { sb.AppendLine(" /// <summary>"); if (!string.IsNullOrEmpty(column.Description)) { StringHelper.LineBreakCode(sb, column.Description, " /// "); } else { sb.AppendLine(" /// The property that the view field '"+ column.DatabaseName + "'"); } sb.AppendLine(" /// </summary>"); sb.AppendLine(" public virtual "+ column.GetCodeType() + " " + column.PascalName + " { get; private set; }"); sb.AppendLine(); } sb.AppendLine(" #endregion"); sb.AppendLine(); }
private void AppendMappingFragment(CustomView view) { sb.AppendFormat(" <MappingFragment StoreEntitySet=\"{0}\">", view.PascalName).AppendLine(); sb.AppendLine(" <ScalarProperty Name=\"pk\" ColumnName=\"__pk\" />"); foreach (var currentColumn in view.GetColumns().Where(x => x.Generated).OrderBy(x => x.Name)) { sb.AppendFormat(" <ScalarProperty Name=\"{0}\" ColumnName=\"{1}\" />", currentColumn.PascalName, currentColumn.DatabaseName).AppendLine(); } sb.AppendFormat(" </MappingFragment>").AppendLine(); }
private void AppendProperties() { sb.AppendLine(" #region Properties"); sb.AppendLine(); var index = 0; foreach (var column in _item.GetColumns().Where(x => x.Generated).OrderBy(x => x.Name)) { CustomView typeTable = null; sb.AppendLine(" /// <summary>"); if (!string.IsNullOrEmpty(column.Description)) { StringHelper.LineBreakCode(sb, column.Description, " /// "); } sb.AppendLine(" /// </summary>"); if (column.IsPrimaryKey) { sb.AppendLine(" [System.ComponentModel.DataAnnotations.Key]"); } sb.AppendLine(" [DataMember]"); sb.AppendLine(" [System.ComponentModel.Browsable("+ column.IsBrowsable.ToString().ToLower() + ")]"); if (!string.IsNullOrEmpty(column.Category)) { sb.AppendLine(" [System.ComponentModel.Category(\""+ column.Category + "\")]"); } sb.AppendLine(" [System.ComponentModel.DisplayName(\""+ column.GetFriendlyName() + "\")]"); if (column.UIDataType != System.ComponentModel.DataAnnotations.DataType.Custom) { sb.AppendLine(" [System.ComponentModel.DataAnnotations.DataType(System.ComponentModel.DataAnnotations.DataType."+ column.UIDataType.ToString() + ")]"); } if (!string.IsNullOrEmpty(column.Description)) { sb.AppendLine(" [System.ComponentModel.Description(\""+ StringHelper.ConvertTextToSingleLineCodeString(column.Description) + "\")]"); } sb.AppendLine(" [System.Diagnostics.DebuggerNonUserCode()]"); //if (column.IsTextType && column.DataType != System.Data.SqlDbType.Xml && column.Length > 0) //{ // sb.AppendLine(" [StringLength(" + column.Length + ")]"); //} sb.AppendLine(" public virtual "+ column.GetCodeType() + " " + column.PascalName + " { get; set; }"); sb.AppendLine(); index++; } sb.AppendLine(" #endregion"); sb.AppendLine(); }
private void AppendProperties() { sb.AppendLine(" #region Properties"); sb.AppendLine(); var index = 0; foreach (var column in _item.GetColumns().OrderBy(x => x.Name)) { CustomView typeTable = null; sb.AppendLine(" /// <summary>"); if (!string.IsNullOrEmpty(column.Description)) { StringHelper.LineBreakCode(sb, column.Description, " /// "); } sb.AppendLine(" /// </summary>"); if (column.IsPrimaryKey) { sb.AppendLine(" [System.ComponentModel.DataAnnotations.Key]"); } if (!string.IsNullOrEmpty(column.Description)) { sb.AppendLine(" [System.ComponentModel.Description(\""+ StringHelper.ConvertTextToSingleLineCodeString(column.Description) + "\")]"); } sb.AppendLine(" [System.Diagnostics.DebuggerNonUserCode()]"); if (column.DataType.IsTextType() && column.IsMaxLength()) { sb.AppendLine(" [StringLengthUnbounded]"); } else if (column.DataType.IsTextType() && !column.IsMaxLength()) { sb.AppendLine($" [System.ComponentModel.DataAnnotations.StringLength({column.Length})]"); } sb.AppendLine(" public virtual "+ column.GetCodeType() + " " + column.PascalName + " { get; protected set; }"); sb.AppendLine(); index++; } sb.AppendLine(" #endregion"); sb.AppendLine(); }