---
lang: en
title: 'API docs: rest-crud.definecrudrepositoryclass'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/rest-crud
permalink: /doc/en/lb4/apidocs.rest-crud.definecrudrepositoryclass.html
---

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

[Home](./index.md) &gt; [@loopback/rest-crud](./rest-crud.md) &gt; [defineCrudRepositoryClass](./rest-crud.definecrudrepositoryclass.md)

## defineCrudRepositoryClass() function

Create (define) a repository class for the given model.

Example usage:

```ts
const ProductRepository = defineCrudRepositoryClass(Product);

```

<b>Signature:</b>

```typescript
export declare function defineCrudRepositoryClass<T extends Entity, IdType, Relations extends object = {}>(entityClass: typeof Entity & {
    prototype: T;
}): RepositoryClass<T, IdType, Relations>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  entityClass | <code>typeof Entity &amp; {</code><br/><code>    prototype: T;</code><br/><code>}</code> |  |

<b>Returns:</b>

`RepositoryClass<T, IdType, Relations>`


