We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
生成数据库时将属性[DisplayName]特性的值添加到表字段的描述信息中
基于 #212 的实现,添加一个批量配置实现,使用HasComment配置实现此需求
/// <summary> /// 给实体属性添加Comment配置 /// 生成数据库时将属性[DisplayName]特性的值添加到表字段的描述信息中 /// </summary> public class PropertyCommentConfiguration : IEntityBatchConfiguration { /// <summary> /// 配置指定的<see cref="IMutableEntityType"/> /// </summary> /// <param name="modelBuilder">模型构建器</param> /// <param name="mutableEntityType">实体的<see cref="IMutableEntityType"/>类型</param> public void Configure(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) { IMutableProperty[] mutableProperties = mutableEntityType.GetProperties().ToArray(); foreach (IMutableProperty mutableProperty in mutableProperties) { if (mutableProperty.PropertyInfo == null) { continue; } string display = mutableProperty.PropertyInfo.GetDescription(); modelBuilder.Entity(mutableEntityType.ClrType).Property(mutableProperty.PropertyInfo.Name).HasComment(display); } } }
services.AddSingleton<IEntityBatchConfiguration, PropertyCommentConfiguration>();
The text was updated successfully, but these errors were encountered:
feat(efcore): 生成数据库时将属性[DisplayName]特性的值添加到表字段的描述信息中 #213 #212
c0cd399
No branches or pull requests
您的功能请求与现有问题有关吗?请描述
生成数据库时将属性[DisplayName]特性的值添加到表字段的描述信息中
描述您想要的解决方案
实现
基于 #212 的实现,添加一个批量配置实现,使用HasComment配置实现此需求
加入DI启用此功能
The text was updated successfully, but these errors were encountered: