# Custom Implementation of REN Repository

While REN’s standard **Repository** service is ready-to-use out of the box, you are never limited to the defaults.\
**REN.Kit DataKit** is built with extensibility and flexibility in mind—so you can easily extend or override the generic repository to fit your unique requirements.

For example, you might want to:

* Add custom logging, monitoring, or caching directly inside repository methods,
* Enforce complex business rules or validation before or after data access,
* Implement advanced querying, filtering, soft-deletes, tenant-specific data, or domain events.



***

## **How to Customize the Repository?**

Simply inherit from the provided `RENRepository<TEntity>` class or implement the `IRENRepository<TEntity>` interface with your own logic. Then, register your custom implementation during service configuration, and REN.Kit will seamlessly use your new repository wherever data access is performed.

{% hint style="success" %}
## **Pro Tip:**

Extension and override patterns make REN.Kit DataKit a great fit for projects of any scale—

* Use the standard repository for speed and simplicity.
* Switch to custom repositories for advanced needs or specialized behaviors.
{% endhint %}

You get the best of both worlds: rapid development **and** full control over your data access logic.

***

## How to Get Customized Repository?

By default, the REN Unit of Work returns the classic `RENRepository` for your entities. However, if you want to use a **custom repository**—for example, one with additional methods or overridden behavior—you’ll need to explicitly request it from the Unit of Work by specifying its type.

> **Note:**\
> Your custom repository **must** inherit from the classic `IRENRepository` interface. If it doesn’t, the Unit of Work will not be able to provide it, and you’ll lose all the benefits of seamless data access and transaction management.

Here’s how you can retrieve a custom repository instance:

```csharp
private readonly IExtendedRENRepository<Employee> customEmployeeRepository = unitOfWork.GetRepository<ExtendedAndOverridedRENRepository<Employee>, Employee>();
```

You’ll find detailed guidance and examples for custom repository usage in the following sections!
