示例#1
0
    public void Configure(EfCoreTableFluent <Song> eb)
    {
        eb.ToTable("tb_song_config");
        eb.Ignore(a => a.Field1);
        eb.Property(a => a.Title).HasColumnType("varchar(50)").IsRequired();
        eb.Property(a => a.Url).HasMaxLength(100);

        eb.Property(a => a.RowVersion).IsRowVersion();
        eb.Property(a => a.CreateTime).HasDefaultValueSql("current_timestamp");

        eb.HasKey(a => a.Id);
        eb.HasIndex(a => a.Title).IsUnique().HasName("idx_tb_song1111");

        //一对多、多对一
        eb.HasOne(a => a.Type).HasForeignKey(a => a.TypeId).WithMany(a => a.Songs);

        //多对多
        eb.HasMany(a => a.Tags).WithMany(a => a.Songs, typeof(Song_tag));
    }
示例#2
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable( EfCoreTableFluent<User> builder ) 
 {
     builder.ToTable( "`Systems.User`" );
 }
示例#3
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <Role> builder)
 {
     builder.ToTable("`Systems.Role`");
 }
示例#4
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <UserInfo> builder)
 {
     builder.ToTable("`Commons.UserInfo`");
 }
示例#5
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <Permission> builder)
 {
     builder.ToTable("`Systems.Permission`");
 }
示例#6
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <Dictionary> builder)
 {
     builder.ToTable("`Commons.Dictionary`");
 }
示例#7
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <Area> builder)
 {
     builder.ToTable("`Commons.Area`");
 }
示例#8
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <ResourcePo> builder)
 {
     builder.ToTable("`Systems.Resource`");
 }
示例#9
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <Administrator> builder)
 {
     builder.ToTable("`Systems.Administrator`");
 }
示例#10
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <ApplicationPo> builder)
 {
     builder.ToTable("`Systems.Application`");
 }
示例#11
0
 /// <summary>
 /// 映射表
 /// </summary>
 protected override void MapTable(EfCoreTableFluent <File> builder)
 {
     builder.ToTable("`Commons.File`");
 }