Back to Devexpress

KeysAutogenerationNonSupportedTypeException Class

xpo-devexpress-dot-xpo-dot-exceptions-49892e82.md

latest1.9 KB
Original Source

KeysAutogenerationNonSupportedTypeException Class

An exception that is thrown when a key field doesn’t support automatic value generation

Namespace : DevExpress.Xpo.Exceptions

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public class KeysAutogenerationNonSupportedTypeException :
    Exception
vb
Public Class KeysAutogenerationNonSupportedTypeException
    Inherits Exception

Remarks

Only Int32, Int64 and Guid key fields support automatic value generation. This exception is thrown when automatic key generation is enabled for a key property but the property type doesn’t support this feature,

Solution:

  • use an integer or GUID property as a key field;

  • disable automatic key generation for a property and set an object’s key manually.

To enable/disable automatic key generation for a property use the autoGeneration parameter of the property’s KeyAttribute attribute.

Inheritance

Object Exception KeysAutogenerationNonSupportedTypeException

See Also

KeysAutogenerationNonSupportedTypeException Members

DevExpress.Xpo.Exceptions Namespace