コード例 #1
0
        protected override void OnModuleConfiguration(IModuleBuilder moduleBuilder)
        {
            moduleBuilder.Entity <User>()
            .TableName("Users", "geto")
            .HasKnownType(x => x.Person, typeof(Person))
            .HasPrimaryKey(x => x.Id, false)
            .NotNullable(x => x.UserName)
            .HasDataEncode(x => x.UserName)
            .HasDataEncode(x => x.Password)
            .HasForeignKey <Role, Guid>(x => x.RoleId)
            .HasIndependentData(x => x.Role)
            .HasForeignKey <Person, Guid>(x => x.PersonId)
            .HasRule <UserRule>()
            .HasJsonIgnore(x => x.Password);

            moduleBuilder.EntityType(typeof(User))
            .TableName("Users", "geto")
            .HasKnownType("Person", typeof(Person))
            .HasPrimaryKey("Id", false)
            .NotNullable("UserName")
            .HasDataEncode("UserName")
            .HasDataEncode("Password")
            .HasForeignKey <Role>("RoleId")
            .HasIndependentData("Role")
            .HasForeignKey <Person>("PersonId")
            .HasRule <UserRule>()
            .HasJsonIgnore("Password");
        }