Table of Contents

Class XpoDefault

Namespace
DevExpress.Xpo
Assembly
DevExpress.Xpo.v24.1.dll

Provides global settings.

public static class XpoDefault
Inheritance
XpoDefault
Inherited Members

Fields

CustomGuidGenerationHandler

Specifies a Func<Guid> delegate called to generate a new GUID value. Refer to the GuidGenerationMode topic to see the example.

public static Func<Guid> CustomGuidGenerationHandler

Field Value

Func<Guid>

DefaultIdentityMapBehavior

Returns the default Identity Map behavior. See IdentityMapBehavior for details.

public const IdentityMapBehavior DefaultIdentityMapBehavior = Weak

Field Value

IdentityMapBehavior

DefaultOptimisticLockingReadBehavior

Specifies the value which is assigned to the XpoDefault.OptimisticLockingReadBehavior property when it is set to the OptimisticLockingReadBehavior.Default value. By default, this field returns the OptimisticLockingReadBehavior.Mixed value.

public const OptimisticLockingReadBehavior DefaultOptimisticLockingReadBehavior = Mixed

Field Value

OptimisticLockingReadBehavior

GuidGenerationMode

Specifies how globally unique identifiers are generated (if the KeyAttribute.AutoGenerate property is true). The default value is FrameworkDefault. To provide a custom Guid primary key generation algorithm, set this field to Custom and assign a Func<Guid> delegate to the XpoDefault.CustomGuidGenerationHandler field. Refer to the GuidGenerationMode topic to see the example.

public static GuidGenerationMode GuidGenerationMode

Field Value

GuidGenerationMode

Specifies how XPO generates new globally unique identifier values.

Properties

ActiveConnectionString

Gets the connection string which is used by newly created connection providers.

public static string ActiveConnectionString { get; }

Property Value

string

A string value that specifies the connection string.

ConnectionString

Gets or sets the string which is used to open a database, by default.

public static string ConnectionString { get; set; }

Property Value

string

A string value which specifies the parameters needed to establish the initial connection.

DataLayer

Gets or sets the default data access layer which is used by Session objects by default, to access a data store.

public static IDataLayer DataLayer { get; set; }

Property Value

IDataLayer

An object which implements the IDataLayer interface; null - in this case, every new session will create and use its own data layer.

DefaultCaseSensitive

Specifies the default setting of the Session.CaseSensitive and XPDataView.CaseSensitive properties.

public static bool DefaultCaseSensitive { get; set; }

Property Value

bool

true to enable case-sensitive string comparisons in sessions, units of work, and XPDataView components; otherwise, false.

DefaultStringMappingFieldSize

Specifies the default size of the database column which the member’s data is stored in. The default value is 100.

public static int DefaultStringMappingFieldSize { get; set; }

Property Value

int

An integer value representing the default size of the database column created for persistent properties or fields.

Dictionary

Gets or sets metadata on the persistent objects in a data store.

public static XPDictionary Dictionary { get; set; }

Property Value

XPDictionary

An XPDictionary object which provides metadata on the persistent objects in a data store.

IdentityMapBehavior

Gets or sets the Identity Map behavior used by Sessions by default.

public static IdentityMapBehavior IdentityMapBehavior { get; set; }

Property Value

IdentityMapBehavior

An IdentityMapBehavior enumeration value that specifies the Identity Map behavior.

IsObjectModifiedOnNonPersistentPropertyChange

Specifies whether or not a persistent object is marked modified when its non-persistent property value is changed.

public static bool IsObjectModifiedOnNonPersistentPropertyChange { get; set; }

Property Value

bool

true, if a persistent object is marked modified when its non-persistent property value is changed; otherwise - false.

NullableBehavior

Specifies if nullable columns should be created when updating the database schema.

public static NullableBehavior NullableBehavior { get; set; }

Property Value

NullableBehavior

A NullableBehavior enumeration value specifying if a nullable column should be created when updating the database schema.

ObjectLayer

Specifies the default object access layer which is used by Session objects by default, to retrieve and update object data in a data store.

public static IObjectLayer ObjectLayer { get; set; }

Property Value

IObjectLayer

An object which implements the IObjectLayer interface; null - in this case, every new session will create and use its own object layer.

OptimisticLockingReadBehavior

Gets or sets a value which specifies how XPO behaves by default when reloading changed objects (objects with different versions).

public static OptimisticLockingReadBehavior OptimisticLockingReadBehavior { get; set; }

Property Value

OptimisticLockingReadBehavior

An OptimisticLockingReadBehavior enumeration value which specifies how XPO behaves when reloading changed objects.

Session

Gets or sets the default session.

public static Session Session { get; set; }

Property Value

Session

A Session object that represents the default session which is used to load and save persistent objects.

TrackPropertiesModifications

Specifies the default value of the Session.TrackPropertiesModifications property of all Sessions.

public static bool TrackPropertiesModifications { get; set; }

Property Value

bool

The boolean value specifying the default value of the Session.TrackPropertiesModifications property of all Sessions. The default is false.

UseFastAccessors

Gets or sets whether XPO uses its internal mechanism to create new instances of persistent classes, and to set and retrieve object property values.

public static bool UseFastAccessors { get; set; }

Property Value

bool

true if XPO uses its internal mechanism to create new instances of persistent classes, and to set and retrieve object property values; false, to use the Reflection.

Methods

ForcePerformanceCountersCreation()

Forces the XPO to create performance counters.

public static void ForcePerformanceCountersCreation()

GetConnectionPoolString(string)

Gets a connection pool’s connection string based on a specified standard connection string. The pool’s capacity and connection limit are set to default values.

public static string GetConnectionPoolString(string connectionString)

Parameters

connectionString string

A string value which specifies the parameters required to establish a connection.

Returns

string

A string value which specifies the parameters needed to establish a connection pool’s connection.

GetConnectionPoolString(string, int)

Gets a connection pool’s connection string based on a specified standard connection string and pool capacity.

public static string GetConnectionPoolString(string connectionString, int poolSize)

Parameters

connectionString string

A string value which specifies the parameters required to establish a connection.

poolSize int

A connection pool’s capacity (the number of connections to be made available within the pool).

Returns

string

A string value which specifies the parameters needed to establish a connection pool’s connection.

GetConnectionPoolString(string, int, int)

Gets a connection pool’s connection string based on a specified standard connection string, pool capacity, and connection limit.

public static string GetConnectionPoolString(string connectionString, int poolSize, int maxConnections)

Parameters

connectionString string

A string value which specifies the parameters required to establish a connection.

poolSize int

A connection pool’s capacity (the number of connections to be made available within the pool). If null (Nothing in Visual Basic) is passed as this parameter, the default value (8) is used. If a negative number is passed as this parameter, the pool capacity is unrestricted.

maxConnections int

The total number of connections to be established, including the poolSize. If null (Nothing in Visual Basic) or negative number is passed as this parameter, the connection limit is considered unspecified. If the maxConnections is less than the poolSize, the maxConnections is assumed be equal to the poolSize.

Returns

string

A string value which specifies the parameters needed to establish a connection pool’s connection.

GetConnectionProvider(AutoCreateOption)

Creates a data store provider (an DevExpress.Xpo.DB.IDataStore instance).

public static IDataStore GetConnectionProvider(AutoCreateOption defaultAutoCreateOption)

Parameters

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

Returns

IDataStore

A data store provider.

GetConnectionProvider(IDbConnection, AutoCreateOption)

Creates a data store provider (an DevExpress.Xpo.DB.IDataStore instance).

public static IDataStore GetConnectionProvider(IDbConnection connection, AutoCreateOption autoCreateOption)

Parameters

connection IDbConnection

A database connection object.

autoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

Returns

IDataStore

A data store provider.

GetConnectionProvider(string, AutoCreateOption)

Creates a data store provider (an DevExpress.Xpo.DB.IDataStore instance).

public static IDataStore GetConnectionProvider(string connectionString, AutoCreateOption defaultAutoCreateOption)

Parameters

connectionString string

A connection string.

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can update the database schema or create a new database.

Returns

IDataStore

A data store provider.

GetConnectionProvider(string, AutoCreateOption, out IDisposable[])

Creates a data store provider (an DevExpress.Xpo.DB.IDataStore instance).

public static IDataStore GetConnectionProvider(string connectionString, AutoCreateOption defaultAutoCreateOption, out IDisposable[] objectsToDisposeOnDisconnect)

Parameters

connectionString string

A connection string.

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

objectsToDisposeOnDisconnect IDisposable[]

An array of IDisposable objects the data store provider creates internally.

Returns

IDataStore

A data store provider.

GetDataLayer(AutoCreateOption)

Creates a data layer for the default connection string and default metadata information.

public static IDataLayer GetDataLayer(AutoCreateOption defaultAutoCreateOption)

Parameters

defaultAutoCreateOption AutoCreateOption

An DevExpress.Xpo.DB.AutoCreateOption value that specifies which operations should be performed when a data store is accessed for the first time.

Returns

IDataLayer

The created SimpleDataLayer object.

GetDataLayer(XPDictionary, AutoCreateOption)

Creates a data layer for the default connection string and specified metadata information.

public static IDataLayer GetDataLayer(XPDictionary dictionary, AutoCreateOption defaultAutoCreateOption)

Parameters

dictionary XPDictionary

An XPDictionary object that provides the metadata information.

defaultAutoCreateOption AutoCreateOption

An DevExpress.Xpo.DB.AutoCreateOption value that specifies which operations should be performed when a data store is accessed for the first time.

Returns

IDataLayer

The created SimpleDataLayer object.

GetDataLayer(IDbConnection, AutoCreateOption)

Creates a data layer for the specified connection and the default metadata.

public static IDataLayer GetDataLayer(IDbConnection connection, AutoCreateOption autoCreateOption)

Parameters

connection IDbConnection

An object implementing the IDbConnection interface that represents an open connection to a data source.

autoCreateOption AutoCreateOption

An DevExpress.Xpo.DB.AutoCreateOption value that specifies which operations should be performed when a data store is accessed for the first time.

Returns

IDataLayer

The created SimpleDataLayer object.

GetDataLayer(IDbConnection, XPDictionary, AutoCreateOption)

Creates a data layer for the specified connection and metadata information.

public static IDataLayer GetDataLayer(IDbConnection connection, XPDictionary dictionary, AutoCreateOption autoCreateOption)

Parameters

connection IDbConnection

An object implementing the IDbConnection interface that represents an open connection to a data source.

dictionary XPDictionary

An XPDictionary object that provides the metadata information.

autoCreateOption AutoCreateOption

An DevExpress.Xpo.DB.AutoCreateOption value that specifies which operations should be performed when a data store is accessed for the first time.

Returns

IDataLayer

The created SimpleDataLayer object.

GetDataLayer(IDbConnection, XPDictionary, AutoCreateOption, out IDisposable[])

Creates a data layer for the specified connection and metadata information and returns objects that need to be disposed of when a connection to a data store is closed.

public static IDataLayer GetDataLayer(IDbConnection connection, XPDictionary dictionary, AutoCreateOption autoCreateOption, out IDisposable[] objectsToDisposeOnDisconnect)

Parameters

connection IDbConnection

An object implementing the IDbConnection interface that represents an open connection to a data source.

dictionary XPDictionary

An XPDictionary object that provides the metadata information.

autoCreateOption AutoCreateOption

An DevExpress.Xpo.DB.AutoCreateOption value that specifies which operations should be performed when a data store is accessed for the first time.

objectsToDisposeOnDisconnect IDisposable[]

Returns an array of objects that should be disposed of when a connection to a data store is closed.

Returns

IDataLayer

The created SimpleDataLayer object.

GetDataLayer(string, AutoCreateOption)

Creates a data access layer.

public static IDataLayer GetDataLayer(string connectionString, AutoCreateOption defaultAutoCreateOption)

Parameters

connectionString string

A connection string.

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

Returns

IDataLayer

An IDataLayer object.

GetDataLayer(string, XPDictionary, AutoCreateOption)

Creates a data access layer.

public static IDataLayer GetDataLayer(string connectionString, XPDictionary dictionary, AutoCreateOption defaultAutoCreateOption)

Parameters

connectionString string

A connection string.

dictionary XPDictionary

A persistent classes metadata provider.

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

Returns

IDataLayer

An IDataLayer object.

GetDataLayer(string, XPDictionary, AutoCreateOption, out IDisposable[])

Creates a data access layer.

public static IDataLayer GetDataLayer(string connectionString, XPDictionary dictionary, AutoCreateOption defaultAutoCreateOption, out IDisposable[] objectsToDisposeOnDisconnect)

Parameters

connectionString string

A connection string.

dictionary XPDictionary

A persistent classes metadata provider.

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

objectsToDisposeOnDisconnect IDisposable[]

An array of IDisposable objects the data store provider creates internally.

Returns

IDataLayer

An IDataLayer object.

GetDictionary()

Gets the dictionary where metadata on persistent objects is stored by default.

public static XPDictionary GetDictionary()

Returns

XPDictionary

An XPDictionary object that provides metadata on persistent objects in a data store.

NewGuid()

Generates a new globally unique identifier (GUID).

public static Guid NewGuid()

Returns

Guid

A Guid structure that represents a globally unique identifier.