Skip to main content
All docs
V25.1
  • .NET 8.0+
    • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

    IMiddleTierClient<TDbContext> Interface

    Declares the API for a Middle Tier client.

    Namespace: DevExpress.ExpressApp.ApplicationBuilder

    Assembly: DevExpress.EntityFrameworkCore.Security.v25.1.dll

    NuGet Package: DevExpress.ExpressApp.EFCore

    Declaration

    public interface IMiddleTierClient<TDbContext> :
        IDisposable
        where TDbContext : DbContext

    Type Parameters

    Name Description
    TDbContext

    The type of DbContext.

    Remarks

    To create a Middle Tier client, configure its settings with the MiddleTierClientBuilder<TDbContext> and call the Build() method. Once created, the client is immutable.

    // Configures client `DbContext` type, server, and authentication settings
    var builder = new MiddleTierClientBuilder<MainDemoDbContext>()
        .UseServer("http://localhost:5000/")
        .UsePasswordAuthentication("user", "password");
    
    // Creates a Middle Tier client instance
    IMiddleTierClient<MainDemoDbContext> client = builder.Build();
    
    // Creates DbContext and operates data
    using(var ctx = client.CreateDbContext()) {
        var data = ctx.Users.ToList();
        // ...
    }
    
    // Disposes the client
    // Note that it is necessary to manually dispose the client when its instance is no longer needed
    client.Dispose();
    
    See Also