Session.AutoCreateOption Property
Gets or sets the action which is performed when the session is connected to a data store.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
NuGet Package: DevExpress.Xpo
#Declaration
[DefaultValue(AutoCreateOption.DatabaseAndSchema)]
public AutoCreateOption AutoCreateOption { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Auto |
Database |
An Auto |
Available values:
Name | Description |
---|---|
Database |
A session will try to automatically create the database if it doesn’t exist. It will also create or update the database schema for any persistent classes currently being used. |
Schema |
A session will automatically create or update the database schema for the persistent classes currently being used. If the database doesn’t exist, it won’t be created by a session. |
None | A session will not automatically create the database or update the database schema. The database schema is still queried and checked to match the currently used persistent class metadata. |
Schema |
A session will never query the database for schema to validate against persistent class metadata. This will suppress the Schema |
#Remarks
To connect a session to a database use the Session.Connect method. The AutoCreateOption property specifies the action which is performed when the session is connected to a data store. For a list of available actions, see the AutoCreateOption topic.
If the AutoCreateOption property is set to the AutoCreateOption.None value, the SchemaCorrectionNeededException is raised every time the database metadata is mismatched.