Back to Devexpress

IMiddleTierClient<TDbContext> Interface

expressappframework-devexpress-dot-expressapp-dot-applicationbuilder-dot-imiddletierclient-1.md

latest2.5 KB
Original Source

IMiddleTierClient<TDbContext> Interface

Declares the API for a Middle Tier client.

Namespace : DevExpress.ExpressApp.ApplicationBuilder

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

NuGet Package : DevExpress.ExpressApp.EFCore

Declaration

csharp
public interface IMiddleTierClient<TDbContext> :
    IDisposable
    where TDbContext : DbContext
vb
Public Interface IMiddleTierClient(Of TDbContext As DbContext)
    Inherits IDisposable

Type Parameters

NameDescription
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.

csharp
// 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

IMiddleTierClient<TDbContext> Members

Middle Tier Security with EF Core

Connect a Non-XAF Application to a Middle Tier Security Server (EF Core)

DevExpress.ExpressApp.ApplicationBuilder Namespace