diff --git a/docs/site/DataSources.md b/docs/site/DataSources.md index cec7cab6312b..1f233e63a7bb 100644 --- a/docs/site/DataSources.md +++ b/docs/site/DataSources.md @@ -71,10 +71,13 @@ await bookDs.connect(); app.dataSource(bookDs, dsName); ``` -For details about datasource options, refer to the -[DataSource documentation])(https://apidocs.strongloop.com/loopback-datasource-juggler/#datasource) +For details about datasource options, refer to the [DataSource +documentation])(https://apidocs.strongloop.com/loopback-datasource-juggler/#datasource) . Attach the newly created datasource to the app by calling `app.dataSource()`. -Note, the `app.repository()` method is available only on application classes + +{% include note.html content=" +The `app.datasource()` method is available only on application classes with `RepositoryMixin` applied. +" %} diff --git a/docs/site/Model.md b/docs/site/Model.md index 7b97c09c8f52..001fffcdbc1f 100644 --- a/docs/site/Model.md +++ b/docs/site/Model.md @@ -117,13 +117,15 @@ export class Customer { Models can be created at runtime using the `defineModelClass()` helper function from the `@loopback/repository` class. It expects a base model to extend (typically `Model` or `Entity`), followed by a `ModelDefinition` object as shown -in the example below. The `ModelDefinition` object is an abstraction for -specifying the various attributes of a LoopBack model. +in the example below. ```ts +const bookDef = new ModelDefinition('Book') + .addProperty('id', {type: 'number', id: true}) + .addProperty('title', {type: 'string'}); const BookModel = defineModelClass( - Entity, - bookDef, + Entity, // Base model + bookDef, // ModelDefinition ); ``` @@ -137,14 +139,17 @@ import DynamicModelCtor from '@loopback/repository'; const StudentModel = defineModelClass< typeof User, // id being provided by the base class User - {university?: string}, + {university?: string} >(User, studentDef); ``` If you want make this new Model available from other parts of the app, you can -call `app.model(StudentModel)` to create a binding for it. Note, the -`app.model()` method is available only on application classes with +call `app.model(StudentModel)` to create a binding for it. + +{% include note.html content=" +The `app.model()` method is available only on application classes with `RepositoryMixin` applied. +" %} ## Model Discovery diff --git a/docs/site/Repositories.md b/docs/site/Repositories.md index 762d5564ddfc..38e9f9f1b154 100644 --- a/docs/site/Repositories.md +++ b/docs/site/Repositories.md @@ -368,8 +368,10 @@ inject(`datasources.${dsName.name}`)(BookRepository, undefined, 0); const repoBinding = app.repository(BookRepository); ``` -Note, the `app.repository()` method is available only on application classes +{% include note.html content=" +The `app.repository()` method is available only on application classes with `RepositoryMixin` applied. +" %} ## Access KeyValue Stores