本文整理匯總了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();
});
}