Plantilla Nano ASP.NET SaaS
Datos de acceso de administrador (todos los inquilinos): admin@email.com / Password123!
Los datos de muestra se restablecen cada hora

Cómo crear una aplicación multitenant con varias bases de datos: guía gratuita (Parte 2)

Ryan Lewis
septiembre 13, 2023

In the last article, we learned the basics of building a multi-tenant application with ASP.NET y Entity Framework. In this article, we will build on that same project and refactor the solution to use a per-tenant database approach.

If you haven’t read the previous article on Building Multi-Tenant Applications with Entity Framework and ASP.NET, please check that out here. If you don’t already have it, download the finished GitHub project of that article because that will serve as the starting point for this article.

Download the finished version of Part 1: Single-Database Multi-Tenant App here from GitHub

The completed version of the multi-tenant solution we will build in this article is also available as a finished GitHub repository.

Download the finished version of this tutorial Part 2: Multiple-Database Multi-Tenant App here from GitHub

Download the Postman collection for testing aquí.

To support multiple databases, we will need to make a few critical changes:

  • Save a connection string per each tenant
  • Add an OnConfiguring method to our database context model to allow for using a different connection string per each request.
  • Add a tenant service & controller to allow creating new tenants
  • Run migrations when creating a new tenant
  • During startup, run any pending migrations on tenant databases

To begin, let’s start by adding a new string field to the Inquilino table and call it Cadena de conexión. This is where we will specify the connection string for the tenant-specific database or choose to leave null and have the tenant use the default shared database. Make sure to allow null values on the Cadena de conexión property by adding a question mark.

público clase Inquilino
{
    [Clave]
    [Generado por la base de datos(Opción generada por la base de datos.Ninguno)]
    público cadena Id { obtener; set; }
    público cadena Nombre { obtener; set; }
    público cadena? Cadena de conexión { obtener; set; }

}

Next we should update our Servicio de inquilinos actuales class and interface to include this new Cadena de conexión field so that the Cadena de conexión property is always available.

En el Establecer inquilino method, we will retrieve the connection string from the database and set the property at the same time that we set the tenant ID.

With that out of the way, we’ll update the ApplicationDbContext class to use the connection string when there is one in its Configuración de override method, which fires on every request.

In the last tutorial, we added two key overrides en el ApplicationDBContext to get our multi-tenant application working. The first was the OnModelCreating override where we added a query filter to select only those records which had matching a tenant Id. The second was the Guardar cambios override where we saved the current tenant Id to any entity that implemented the IMustHaveTenant interface.

We will now add a third override to tell entity framework to use a different connection string whenever there’s one specified by the current tenant. The override we will add is the Configuración de method, which fires on every request.

 público clase ApplicationDbContext : DbContext
 {
     privado solo lectura ICurrentTenantService _currentTenantService;
     público cadena IdDelInquilinoActual { obtener; set; }
     público cadena Cadena de conexión del inquilino actual { obtener; set; }


     // Constructor 
     público ApplicationDbContext(ICurrentTenantService currentTenantService, DbContextOptions<ApplicationDbContext> opciones) : base(opciones)
     {
         _currentTenantService = currentTenantService;
         IdDelInquilinoActual = _currentTenantService.Id. del inquilino;
         Cadena de conexión del inquilino actual = _currentTenantService.Cadena de conexión;

     }

     // DbSets de la aplicación: se crean para los tipos de entidad y se aplican a todas las bases de datos
     público DbSet<Producto> Productos { obtener; set; }

     // Al crear el modelo: filtro de consulta multitenencia; se ejecuta una vez al iniciar la aplicación
     protegido anular nulo OnModelCreating(Generador de ModelBuilder)
     {         
         constructor.Entidad<Producto>().HasQueryFilter(a => a.Id. del inquilino == IdDelInquilinoActual); 
     }

     // Sobre la configuración: cadena de conexión dinámica, se ejecuta en cada solicitud
     protegido anular nulo Configuración de(DbContextOptionsBuilder optionsBuilder)
     {
         cadena cadena de conexión del inquilino = Cadena de conexión del inquilino actual;
         si (!cadena.IsNullOrEmpty(cadena de conexión del inquilino)) // utilizar la base de datos del inquilino si se ha especificado alguna
         {
             _ = optionsBuilder.UseSqlServer(cadena de conexión del inquilino);
         }
     }
     
     // Al guardar los cambios: escribir el ID del inquilino en la tabla
     público anular int Guardar cambios()
     {        
         foreach (var entrada en ChangeTracker.Entradas<IMustHaveTenant>().ToList()) 
         {
             interruptor (entrada.Estado)
             {
                 caso Estado de la entidad.Añadido:
                 caso Estado de la entidad.Modificado:
                     entrada.Entidad.Id. del inquilino = IdDelInquilinoActual; 
                     break;
             }
         }
         var resultado = base.Guardar cambios();
         volver resultado;
     }
 }

The code in the Configuración de override checks for any tenant specific connection string for the current tenant and when there is one, passes that connection string as an option optionsBuilder. Doing this will tell entity framework to use this connection string for the current request. If the current tenant connection string is null, the optionsBuilder code isn’t triggered and the request will use the default connection string like it normally would.

In a multiple database setup, we need to consider that there are two types of databases. One being the main ‘central’ shared database that stores the tenant table itself, along with any other configuration-related tables that we may add in the future like subscription, billing, or even identity. And then there are all the other databases, which are per-tenant and should not contain those central configuration tables. The tenant-specific databases should only contain application-related tables, like Productos and any more that we add.

To achieve this, we will need manage two sets of migrations: one set for entities that are exclusive to the central database, and another set for all the other tables which can be found across all the databases.

Let’s begin by removing the migraciones and database snapshot we created in the previous tutorial (there should only be one called initial).  We should also remove the Tenants DbSet from the ApplicationDbContext because we don’t want that table to be generated in the tenant-specific databases.

If we were being strict about every tenant having their own database, we could actually remove the tenant query filters and tenant ID columns. Its better to leave it though because it will allow for tenants to share the same database and still retain data isolation. This is what you would call a híbrido multi-tenant implementation.

In our single-database multi-tenant setup, we used the TenantDbContext purely for looking up tenant information when a request comes in. It was essentially a read-only context and had no responsibilities in terms of migrations. In this multi-database setup, we’ll still be using it as a lookup context for incoming request, but we’ll also use it to manage migrations on tables specific to the main central database.  The ApplicationDbContext will manage migrations on tables found across every tenant database.

Abre Consola del gestor de paquetes and create an initial migration for the central database. For that we will need to target the TenantDbContext. To keep things organized, we can also specify an output directory for migrations to keep the two groups separate with the -o switch. Here is the command:

add-migration Initial -context TenantDbContext -o Migrations/TenantDb

Lets apply the migration by typing the following:

update-database -context TenantDbContext 

Now if we go explore our databases, can see that one was created and it contains one table for tenants. If we expand the migrations folder in the solution explorer, we should see there is a new subfolder called TenantDb and that contains our migration. If that’s the case for you, then you’ve done everything correctly up to this point.

Next, we’ll create another migration this time for the ApplicationDbContext. Back in Consola del gestor de paquetes type the following command, this time notice we specify a new context and a new output directory:

add-migration InitialApp -context ApplicationDbContext -o Migrations/AppDb

Let’s apply the migration by typing the following:

update-database -context ApplicationDbContext 

If we check the database now, we’ll see that the products table has been created. In the solution explorer, there is another folder in migrations with the new migration we just added.

En el single-database setup from the previous tutorial, we never actually made a service or controller to handle creation of new tenants. In that simplistic setup, we just added the tenants manually in the table itself. With a multiple database setup however, that will not suffice because we will need to run some automation when we create new tenants. Every time a new tenant is created, we’ll need to generate a connection string, spin up a new database, and apply any pending migrations.

Start by creating a new folder in Servicios llamado Servicio al inquilino and add an interface called ITenantService. In this interface define one method called Crear inquilino. In a real application, there should be methods for retrieving lists, and updating tenants. For brevity, we will only worry about creating tenants in this tutorial.

público interfaz ITenantService
{
    Inquilino Crear inquilino(Solicitud CreateTenantRequest);
}

Crear un nuevo DTO folder within the Servicio al inquilino folder and call it CreateTenantRequest. It will contain an ID y Nombre property like the Inquilino entity itself and also a Booleano field called Aislado to indicate if this tenant should have its own isolated database.

público clase CreateTenantRequest
{
    público cadena Id { obtener; set; }
    público cadena Nombre { obtener; set; }
    público bool Aislado { obtener; set; }
}

Finally let’s create the service itself, called Servicio al inquilino.

público clase Servicio al inquilino : ITenantService
{

    privado solo lectura TenantDbContext _context; // contexto de la base de datos
    privado solo lectura IConfiguration _configuration;
    privado solo lectura IServiceProvider _serviceProvider;

    público Servicio al inquilino(TenantDbContext context, Configuración de IConfiguration, IServiceProvider serviceProvider)
    {
        _contexto = contexto;
        _configuración = configuración;
        _proveedorDeServicios = proveedor de servicios;
    }

    público Inquilino Crear inquilino(Solicitud CreateTenantRequest)
    {

        cadena nuevaCadenaDeConexión = null;
        si (solicitud.Aislado == verdadero)
        {
            // generar una cadena de conexión para la nueva base de datos del inquilino
            cadena dbName = "multiTenantAppDb-" + solicitud.Id;
            cadena cadena de conexión predeterminada = _configuración.Obtener cadena de conexión("Conexión predeterminada");
            nuevaCadenaDeConexión = cadena de conexión predeterminada.Sustituir("multiTenantAppDb", dbName);

            // Crear una nueva base de datos de inquilinos y actualizarla con las migraciones pendientes de ApplicationDbContext
            inténtalo
            {
                utilizando IServiceScope scopeTenant = _proveedorDeServicios.CreateScope();
                ApplicationDbContext dbContext =   scopeTenant.Proveedor de servicios.GetRequiredService<ApplicationDbContext>();
                dbContext.Base de datos.Establecer cadena de conexión(nuevaCadenaDeConexión);
                si (dbContext.Base de datos.GetPendingMigrations().Cualquiera())
                {
                    Consola.Color de primer plano = ConsoleColor.Azul;
                    Consola.WriteLine("$»Aplicación de las migraciones de ApplicationDB para el nuevo '{solicitud.Id}' inquilino.");
                    Consola.Restablecer color();
                    dbContext.Base de datos.Migrar();
                }
            }
            atrapar (Excepción ex)
            {
                lanzar nuevo Excepción(ex.Mensaje);
            }
        }


        Inquilino inquilino = nuevo() // crear una nueva entidad de inquilino
        {
            Id = solicitud.Id,
            Nombre = solicitud.Nombre,
            Cadena de conexión = nuevaCadenaDeConexión,
        };

        _contexto.Añadir(inquilino);
        _contexto.Guardar cambios();

        volver inquilino;
    }
}

In this service, we’ll use the TenantDbContext to interact with tenant data since its data that is managed only in the central database. The Crear inquilino method takes the DTO as a request and in the case of an isolated tenant, performs several additional steps.

The first step is to generate a new connection string. We could just hard code a base connection string, but a slightly more elegant solution is to use the IConfiguration interface, which allows us to read fields from appsettings.json. We read the Conexión predeterminada de appsettings.json and simply add a dash with the Id of the tenant to the central database name. In a real application, you might want to ensure that no whitespace or illegal characters are present in the Id of the tenant before proceeding further.

The next step is critical. Using the help of the IServiceProvider interface, we pull down a new scoped instance of the ApplicationDbContext from the service provider. With this instance, we set the new connection string on it and then check for any pending migrations. Of course there will be pending migrations because there isn’t even a database created yet. The framework will detect that and apply all pending ApplicationDbContext migrations.

Isolated database or not, the final step of the create tenant method is to save the new Tenant to the main database.

Lastly, in Program.cs we’ll need to add the Tenant service to the service container as a transient service so it can be used throughout our application. Add the following line after the product service we created in the previous tutorial.

constructor.Servicios.Añadir transitorio<ITenantService, Servicio al inquilino>();

To make use of the new tenant service and interact with it via REST API calls, create a new Controlador de API en el Controladores una carpeta llamada Controlador de inquilinos. We’ll inject the servicio para inquilinos in the constructor and use it in the Post method as follows:

[Ruta("api/[controlador]")]
[ApiController]
público clase Controlador de inquilinos : ControllerBase
{
    privado solo lectura ITenantService _tenantService;

    público Controlador de inquilinos(ITenantService tenantService)
    {
        _tenantService = servicio para inquilinos;
    }

    público ITenantService TenantService { obtener; }

    // Crear un nuevo inquilino
    [HttpPost]
    público IActionResult Publicación(Solicitud CreateTenantRequest)
    {
        var resultado = _tenantService.Crear inquilino(solicitud);
        volver Vale(resultado);
    }
}

With that out of the way, run the application and we can open up Postman to test everything out.

Make a new Publicación API call with the following JSON in the body. The Nombre of the tenant can be however you want but the Id cannot contain any special characters or whitespace. The Id remember is what will be appended to the database name to create the new tenant-specific database. Set the Aislado boolean to verdadero so that a new database is created when you send the request.

Here is a postman collection you can use to make your life easier.

Once you click send, you should receive a 200 OK status response and a new database should appear when you refresh your database explorer! Create a few more tenants both isolated and shared to see what happens.

The query filters and dynamic connection string should be working too. Try creating some sample products to see what happens. Remember to change the tenant ID in the header when sending requests. New products will be saved to their tenant databases when a connection string is specified. Now obviously this is in no way secure since anyone can just change the request header and access another tenant. To secure the application you would need to integrate ASP Identity and store/read the tenant key in a token. The Nano ASP.NET Boilerplate has that all taken care of already along with a lot of other great features and will definitely save you a lot of time messing with that.

Alas we have multi-tenant behavior implemented in a per-tenant database model! But we can’t call it a day just yet. We need to consider what happens when we create new migrations. If we add a new field to Product and run a migration, that migration won’t be applied to all the tenant databases, only the central one. That is a problem that we will address in the following section.

Running the actualizar-base-de-datos command will apply migrations on only the one database specified in the default connection string found in appsettings.json. What we need is to loop through each tenant, and apply migrations for every database found – not just the main one. Luckily, there is a way to programmatically apply migrations instead of having to type the command into PMC using the .migrate() method. We’ll rely on this method to achieve the goal.

In summary what we need to do is:

  • Tap into the app startup process using a service extension
  • Apply any migrations to the main database (TenantDbContext)
  • Read the Tenant table
  • Loop through each tenant
  • When a tenant has a connection string, apply any ApplicationDbContext migrations for this database instance

Start by creating a new folder in the solution explorer called Extensiones. What we are creating here is an extension method to the app configuration process. I’ve named this static class Extensiones de bases de datos múltiples and it has one method Añadir y migrar bases de datos de inquilinos. The code is as follows:

público estático clase Extensiones de bases de datos múltiples
{
    público estático IServiceCollection Añadir y migrar bases de datos de inquilinos(esto Servicios de IServiceCollection,   Configuración de IConfiguration)
    {

        // Contexto de la base de datos de inquilinos (contexto de referencia): obtener una lista de inquilinos
        utilizando IServiceScope scopeTenant = servicios.BuildServiceProvider().CreateScope();
        TenantDbContext tenantDbContext = scopeTenant.Proveedor de servicios.GetRequiredService<TenantDbContext>();

        si (tenantDbContext.Base de datos.GetPendingMigrations().Cualquiera())
        {
            Consola.Color de primer plano = ConsoleColor.Azul;
            Consola.WriteLine("Aplicación de las migraciones de BaseDb.");
            Consola.Restablecer color();
            tenantDbContext.Base de datos.Migrar(); // aplicar las migraciones en baseDbContext
        }


        Lista<Inquilino> tenantsInDb = tenantDbContext.Inquilinos.ToList();

        cadena cadena de conexión predeterminada = configuración.Obtener cadena de conexión("Conexión predeterminada"); // leer la cadena de conexión predeterminada de appsettings.json

        foreach (Inquilino inquilino en tenantsInDb) // Recorrer todos los inquilinos y aplicar las migraciones en applicationDbContext
        {
            cadena cadena de conexión = cadena.IsNullOrEmpty(inquilino.Cadena de conexión) ? cadena de conexión predeterminada : inquilino.Cadena de conexión;

            // Contexto de la base de datos de la aplicación (app - por inquilino)
            utilizando IServiceScope scopeApplication = servicios.BuildServiceProvider().CreateScope();
            ApplicationDbContext dbContext = scopeApplication.Proveedor de servicios.GetRequiredService<ApplicationDbContext>();
            dbContext.Base de datos.Establecer cadena de conexión(cadena de conexión);
            si (dbContext.Base de datos.GetPendingMigrations().Cualquiera())
            {
                Consola.Color de primer plano = ConsoleColor.Azul;
                Consola.WriteLine("$»Aplicación de migraciones para '{inquilino.Id}' inquilino.");
                Consola.Restablecer color();
                dbContext.Base de datos.Migrar();
            }
        }

        volver servicios;
    }

}

This class is going to take care of migrations for both contexts, TenantDbContext y ApplicationDbContext. First it will create a scoped instance of the TenantDbContext on the main database. We know it’s the main database because we aren’t specifying any connection string options and it will therefore use the default one. If there any TenantDbContext migrations pending, they will get applied.

Next, we read a list of Tenants using this same context instance. We loop through each tenant in the list and if there is a connection string present, we use it. Otherwise, in a case of null, we set the connection string to the default database. Any pending ApplicationDbContext migrations are then applied to the target database instance.

Finally, we need to hook this into the app configuration process back in program.cs. Right after the code that adds database contexts, add this line. Now this extension will run whenever the app starts.

constructor.Servicios.Añadir y migrar bases de datos de inquilinos(constructor.Configuración);

This is how the Program.cs class should look at this point

utilizando Microsoft.EntityFrameworkCore;
utilizando multiTenantApp.Extensiones;
utilizando multiTenantApp.Middleware;
utilizando multiTenantApp.Modelos;
utilizando multiTenantApp.Servicios;
utilizando multiTenantApp.Servicios.Productos y servicios;
utilizando multiTenantApp.Servicios.Servicio al inquilino;

var constructor = Aplicación web.CreateBuilder(args);

// Añadir servicios al contenedor.
constructor.Servicios.Añadir controladores();
constructor.Servicios.Añadir puntos finales en el explorador de API();

// Servicio de inquilino actual con un ciclo de vida limitado (creado para cada solicitud)
constructor.Servicios.AddScoped<ICurrentTenantService, Servicio de inquilinos actuales>();

// Añadir un servicio de base de datos con su configuración: cadena de conexión leída de appsettings.json
constructor.Servicios.AddDbContext<ApplicationDbContext>(opciones => opciones.UseSqlServer(constructor.Configuración.Obtener cadena de conexión("Conexión predeterminada")));
constructor.Servicios.AddDbContext<TenantDbContext>(opciones => opciones.UseSqlServer(constructor.Configuración.Obtener cadena de conexión("Conexión predeterminada")));
constructor.Servicios.Añadir y migrar bases de datos de inquilinos(constructor.Configuración);

// Servicio CRUD de productos con duración transitoria
constructor.Servicios.Añadir transitorio<ITenantService, Servicio al inquilino>();
constructor.Servicios.Añadir transitorio<IProductService, Productos y servicios>();

var app = constructor.Compilar();

app.Redirección a HTTPS();
app.Autorización de uso();
app.UseMiddleware<TenantResolver>();
app.MapControllers();

app.Correr();

To test out our new extension, create a new string field in the Productos table called Proveedor. Generate a new migration with the following command, remember to specify the contexto y el salida folder. Since Producto is an application table found in every database, we will use the ApplicationDbContext:

add-migration AddFieldToProduct -context ApplicationDbContext -o Migrations/AppDb

Now that our migrations are handled programmatically, all we need to do is run the application. There’s no need to run the actualizar-base-de-datos command. If you do run the actualizar-base-de-datos command, you will get a message saying that no migrations were applied. This is because before Entity Framework applies the migrations, it builds the application. During that build process, our application applies the pending migrations. As a result, by the time the command runs, no migrations are pending.

Run the app and inspect the databases. You will see that the new field has been added to our main database and all of the tenant databases as well. We now have a completely functional multiple database multi-tenant setup.

Any migrations on both the TenantDbContext y ApplicationDbContext will be handled programmatically by this new extension method.

We may find ourselves feeling like Ripley from the original Alien film now, having nuked the USCSS Nostromo and thinking our problems are behind us. But suddenly the alien crawls out of the wall for one final fight. And here is that scene for us:

There is one last issue and that is that you will get an error if you try to add any fields to the Inquilino table. Strangely, adding new entities to the TenantDbContext or modifying any of those entities wont result in any problem. Only the Inquilino table will give you an error. Try adding a new field to the Tenant entity called SubscriptionLevel and create a new migration. Remember to specify the TenantDbContext and the output directory:

add-migration AddFieldToTenant -context TenantDbContext -o Migrations/TenantDb

Now run the app to apply the migration. This is the error you will receive

This, as you could image, took hours to figure out just what in the actual F&#! was going on when I first encountered the issue.

The problem is in our Añadir y migrar bases de datos de inquilinos method, where we read a list of Inquilinos from the Tenants table. We cannot read from a table that is being modified during design time. Well, we can but we need to tell the Entity Framework scaffolding tool explicitly which connection string we want to use in design time.

Entity Framework Core provides an interface we can use to specify criteria we want to use which will override and default behavior during design time. That interface is aptly named IDesignTimeDbContextFactory and it takes the DbContext in question as a type. Create a new class in the Modelos una carpeta llamada TenantDbContextFactory and follow the code example below:

público clase TenantDbContextFactory : IDesignTimeDbContextFactory<TenantDbContext>
{
    público TenantDbContext CreateDbContext(cadena[] args) // Es necesario para que el diseñador de migraciones de EF se ejecute en este contexto
    {

        // Generar la configuración leyendo el archivo appsettings.json (requiere el paquete NuGet Microsoft.Extensions.Configuration.Json)
        Configuración de IConfigurationRoot = nuevo ConfigurationBuilder()
            .Establecer ruta base(Directorio.GetCurrentDirectory())
            .Añadir archivo JSON("appsettings.json")
            .Compilar();

        // Obtener la cadena de conexión de la configuración
        cadena cadena de conexión = configuración.Obtener cadena de conexión("Conexión predeterminada");


        DbContextOptionsBuilder<TenantDbContext> optionsBuilder = nuevo();
        _ = optionsBuilder.UseSqlServer(cadena de conexión);
        volver nuevo TenantDbContext(optionsBuilder.Opciones);
    }
}

The critical line of code is the DbContextOptionsBuilder<TenantDbContext> part near the end where we specify the connection string. The rest of the code is just making things clean by reading the default connection string from appsettings.json to avoid hard coding it in this class. To read from configuration in this class you will need to install one Nuget package, Microsoft.Extensions.Configuration.Json.

With that class added, run the app to apply the new migration. The app should start without issue and the new field will be added to the tenant table.

Well, that was fun, wasn’t it? Now you can tell all your friends you know how to create a multi-tenant application with a database per tenant implementation and they will no doubt think that that’s awesome. They may even proceed to tell you about their new app idea and ask you to build it for them.

There are a few things to consider before embarking down the database per tenant path. One is that this setup is only complete on our local development environment. You would need to add additional code to handle creating new databases on your cloud provider’s infrastructure. Cloud providers like Azure and AWS provide .NET SDKs for this very thing.

The other concern is that managing migrations can be difficult in situations where things go wrong. Imagine a scenario though where you have 50 tenant databases and for some reason one of them throws an error. Reverting to a previous state or doing any kind of backtracking is notoriously difficult. You should plan for these kinds of issues before deciding to run multiple databases.

Consider all the pros and cons of a multiple database setup before choosing it. A multi-database setup may be more efficient when it comes to scaling but single database multi-tenant setups are much easier to manage in regards to deployment and migrations.

If you are planning to build an MVP and are looking for it to scale and have robust SaaS features, consider using the Nano ASP.NET Boilerplate. You’ll yourself a lot of time getting your project off the ground.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

3 comments on “Build a Multi-Tenant App With Multiple Databases – Free Guide (Part 2)”

  1. Ntsikelelo dice:

    This was amazing! I am new to the world of multi-tenancy, could not have wished for a better intro.

  2. John Holliday dice:

    Execellent read. I’m using the .NET 8.0 version which has similar functionality, but does not map to the code you reference in this article. It would be great to have an updated version that matches the code.

  3. Michel dice:

    This post help me a lot. Thanks for sharing.

¿Necesitas una plantilla de ASP.NET para desarrollar tu próximo MVP?
Echa un vistazo al proyecto de plantilla Nano ASP.NET para SaaS multitenant y ahorra semanas o meses de tiempo de desarrollo.
Más información