(D) the entity properties FreeSql Fluent Api

FreeSql provided using Fluent Api, characteristics of the configuration database entity outside, Fluent Api methods consistent naming the property name, as follows:

fsql.CodeFirst
    .ConfigEntity<TestFluenttb1>(a => {
        a.Name("xxdkdkdk1").SelectFilter("a.Id22 > 0");
        a.Property(b => b.Id).Name("Id22").IsIdentity(true);
        a.Property(b => b.name).DbType("varchar(100)").IsNullable(true);
    })
    .ConfigEntity<TestFluenttb2>(a => {
        a.Name("xxdkdkdk2").SelectFilter("a.Idx > 0");
        a.Property(b => b.Id).Name("Id22").IsIdentity(true);
        a.Property(b => b.name).DbType("varchar(100)").IsNullable(true);
    });

//以下为实体类
class TestFluenttb1
{
    public int Id { get; set; }
    public string name { get; set; } = "defaultValue";
}

[Table(Name = "cccccdddwww")]
class TestFluenttb2
{
    public int Id { get; set; }

    public string name { get; set; } = "defaultValue";
}

fsql is a IFreeSql objects

priority

FluentApi <entity properties

Guess you like

Origin www.cnblogs.com/FreeSql/p/11531304.html