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.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
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