本文整理汇总了TypeScript中aurelia-orm.Repository类的典型用法代码示例。如果您正苦于以下问题:TypeScript Repository类的具体用法?TypeScript Repository怎么用?TypeScript Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Repository类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(entityManager: EntityManager, router: Router) {
this.entityManager = entityManager;
this.userRepository = entityManager.getRepository('users');
this.repository = entityManager.getRepository('customers');
this.customer = this.repository.getNewEntity();
this.router = router;
}
示例2:
.then(user => {
this.user = this.userRepository.getPopulatedEntity(user, this.user);
if (params.id) {
this.customer = this.user.customers.filter( customer => customer.id == params.id)[0];
console.log(this.customer, this.customer.isNew())
} else {
this.customer.setData({firstName: '', lastName: '', userId: USER_ID});
}
this.original = this.customer.asObject();
this.customer.markClean();
});
示例3: activate
activate(params) {
return this.userRepository.find(USER_ID)
.then(user => {
if (params.id) {
this.customer = user.customers.filter( customer => customer.id == params.id)[0];
} else {
this.customer.setData({firstName: '', lastName: '', userId: USER_ID});
}
this.original = this.customer.asObject();
this.customer.markClean();
});
}