---
lang: en
title: 'API docs: repository.crudrepositoryimpl'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.repository.crudrepositoryimpl.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [CrudRepositoryImpl](./repository.crudrepositoryimpl.md)

## CrudRepositoryImpl class

Repository implementation

<b>Signature:</b>

```typescript
export declare class CrudRepositoryImpl<T extends Entity, ID> implements EntityCrudRepository<T, ID> 
```

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(dataSource, entityClass)](./repository.crudrepositoryimpl._constructor_.md) |  | Constructs a new instance of the <code>CrudRepositoryImpl</code> class |

## Properties

|  Property | Modifiers | Type | Description |
|  --- | --- | --- | --- |
|  [dataSource](./repository.crudrepositoryimpl.datasource.md) |  | <code>DataSource</code> |  |
|  [entityClass](./repository.crudrepositoryimpl.entityclass.md) |  | <code>typeof Entity &amp; {</code><br/><code>        prototype: T;</code><br/><code>    }</code> |  |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [count(where, options)](./repository.crudrepositoryimpl.count.md) |  |  |
|  [create(entity, options)](./repository.crudrepositoryimpl.create.md) |  |  |
|  [createAll(entities, options)](./repository.crudrepositoryimpl.createall.md) |  |  |
|  [delete(entity, options)](./repository.crudrepositoryimpl.delete.md) |  |  |
|  [deleteAll(where, options)](./repository.crudrepositoryimpl.deleteall.md) |  |  |
|  [deleteById(id, options)](./repository.crudrepositoryimpl.deletebyid.md) |  |  |
|  [execute(command, parameters, options)](./repository.crudrepositoryimpl.execute.md) |  |  |
|  [exists(id, options)](./repository.crudrepositoryimpl.exists.md) |  |  |
|  [find(filter, options)](./repository.crudrepositoryimpl.find.md) |  |  |
|  [findById(id, filter, options)](./repository.crudrepositoryimpl.findbyid.md) |  |  |
|  [replaceById(id, data, options)](./repository.crudrepositoryimpl.replacebyid.md) |  |  |
|  [save(entity, options)](./repository.crudrepositoryimpl.save.md) |  |  |
|  [update(entity, options)](./repository.crudrepositoryimpl.update.md) |  |  |
|  [updateAll(data, where, options)](./repository.crudrepositoryimpl.updateall.md) |  |  |
|  [updateById(id, data, options)](./repository.crudrepositoryimpl.updatebyid.md) |  |  |

## Example

User can import `CrudRepositoryImpl` and call its functions like: `CrudRepositoryImpl.find(somefilters, someoptions)`

Or extend class `CrudRepositoryImpl` and override its functions:

```ts
export class TestRepository extends CrudRepositoryImpl<Test> {
  constructor(dataSource: DataSource, model: Test) {
    super(dataSource, Customer);
  }

  // Override `deleteAll` to disable the operation
  deleteAll(where?: Where, options?: Options) {
    return Promise.reject(new Error('deleteAll is disabled'));
  }
}

```


