Skip to main content
.NET Framework 4.6.2+

Session.UpdateSchemaAsync(CancellationToken) Method

Asynchronously updates the storage schema according to the class descriptions that are listed in the assemblies that have been loaded into the application domain.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public Task UpdateSchemaAsync(
    CancellationToken cancellationToken = default(CancellationToken)
)

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

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

Returns

Type Description
Task

A Task that updates the storage schema according to the class descriptions that are listed in the assemblies that have been loaded into the application domain.

Remarks

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