我想在页面回帖之前用javascript做点什么.
如何在任何asp.net回发之前运行javascript函数?
$('form').submit(function () {
alert('hello');
});
Run Code Online (Sandbox Code Playgroud)
它不起作用...... :(
在单表继承场景中,有没有办法将数据库中保存的 BaseEntity 对象更新为 InheritedEntity 对象?
请考虑以下场景:
@Entity()
@TableInheritance({column: {name: 'type', type: "varchar"}})
export class BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column()
title: string;
}
@ChildEntity()
export class ChildEntityOne extends BaseEntity {
@Column()
job: string;
}
//
// Create and save a BaseEntity object in database
//
const base = new BaseEntity();
base.title = 'Foo';
await getRepository(BaseEntity).save(base);
//
// Now I have the following in my database
// { id: 1, title: 'Foo', job: null, type: 'BaseEntity' }
//
// …Run Code Online (Sandbox Code Playgroud)