Skip to main content
.NET 6.0+

Session.UpdateSchemaAsync(CancellationToken, Assembly[]) Method

Asynchronously updates the storage schema according to the class descriptions that are listed in the specified assemblies.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

public Task UpdateSchemaAsync(
    CancellationToken cancellationToken,
    params Assembly[] assemblies
)

Parameters

Name Type Description
cancellationToken CancellationToken

A CancellationToken object that delivers a cancellation notice to the running operation.

assemblies Assembly[]

An array of Assembly objects that represent the assemblies used to scan for persistent objects.

Returns

Type Description
Task

A Task that updates the storage schema according to the class descriptions that are listed in the specified assemblies.

Remarks

using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using DevExpress.Xpo;
using DevExpress.Xpo.DB;
// ...
public async Task CreateDatabase(string connectionString, params Assembly[] assemblies) {
    using(IDataLayer dal = XpoDefault.GetDataLayer(connectionString, AutoCreateOption.DatabaseAndSchema)) {
        UnitOfWork uow = new UnitOfWork(dal);
        await uow.UpdateSchemaAsync(CancellationToken.None, assemblies);
        await uow.CreateObjectTypeRecordsAsync(CancellationToken.None, assemblies);
    }
}
See Also