# ORM

An ORM is a system to manipulate data from a database programatically. There are many ORMs that you can adapt and use in Mandarine, although, Mandarine has its own built-in ORM framework that gives you a unique experience because of _Mandarine Query Language_ (MQL).

## Concepts

* Models / Entities
  * Classes that represent a table in your database, this class has columns (properties) and it will be used for your database to interact with your code and vice-versa.
* Repositories
  * An abstract class that contains your queries as well as predefined queries such as **save, findAll, deleteAll, countAll**
  * Repositories can contain custom queries or _MQL_ queries.
  * Repositories are Mandarine Components, but they are only used for database interaction purposes which means you they **cannot** receive injections as described [here](https://mandarineframework.gitbook.io/mandarine-ts/mandarine-core/dependency-injection#concepts).
* Proxy Method
  * A proxy method is a hidden processor for one or more of your methods.
  * Mandarine uses a proxy method to write & execute your database queries in order to avoid writing this kind of code on your application's layer.
  * Proxy methods are implemented behind mandarine repositories.

## Mandarine data sources

Mandarine's built-in ORM framework only supports one native data source from your configuration's file. The ability to use two or more data sources and integrate them with your mandarine-powered application is not expected in the upcoming releases.&#x20;

You can create your own services & processors for your database operations by using [Mandarine components](https://mandarineframework.gitbook.io/mandarine-ts/mandarine-core/components).

## Dialects

[See enum here](https://doc.deno.land/https/raw.githubusercontent.com/mandarineorg/mandarinets/master/orm-core/mandarine-orm.ns.ts#MandarineORM.Dialect.Dialects)

Currently, Mandarine's built-in ORM only supports:

* PostgreSQL

**Note** that support for MySQL is expected to be added in upcoming weeks [(See here)](https://github.com/mandarineorg/mandarinets/issues/13).
