# Auto Incrementing ID Module

#### WARNING

Starting with DevExpress Version 25.1, you should migrate to the new Llamachant.ExpressApp modules instead. Support for this module will end soon.

**Supported Platforms:** ✅ WinForms, ✅ WebForms, ✅ Blazor

The Auto Incrementing ID Module allows developers to quickly add incrementing IDs to business objects.

## Getting Started

1. Install `LlamachantFramework.AutoIncrementingID.Module` from NuGet
2. Include `LlamachantFrameworkAutoIncrementingIDModule` in your `.Module` project

```csharp
public DXApplication1Module() {
    RequiredModuleTypes.Add(typeof(LlamachantFrameworkAutoIncrementingIDModule));
}
```

You can define SQL query-based event handlers for trigger control:

```csharp
public override void Setup(XafApplication application) {
    base.Setup(application);
    application.SetupComplete += Application_SetupComplete;
}

private void Application_SetupComplete(object sender, EventArgs e) {
    var module = LlamachantFrameworkAutoIncrementingIDModule.FindAutoIncrementingModule(Application.Modules);
    if (module != null) {
        module.TriggerCreating += Module_TriggerCreating;
    }
}

private void Module_TriggerCreating(object sender, TriggerEventArgs e) {
    // Custom trigger logic here
}
}
```

## Sample Object Implementation

```csharp
[DefaultClassOptions]
public class Quote : BaseObject {
    public Quote(Session session) : base(session) { }

private int _ID;
    [AutoIncrement]
    public int ID {
        get => _ID;
        set => SetPropertyValue(nameof(ID), ref _ID, value);
    }

private string _CustomerName;
    public string CustomerName {
        get => _CustomerName;
        set => SetPropertyValue(nameof(CustomerName), ref _CustomerName, value);
    }
}
```

📸 _[Screenshot Placeholder: Quote Object Auto Increment Setup]_

### Add Parameter-Based Auto Increment Logic

Specify a unique field for ID tracking:

```csharp
[AutoIncrement(nameof(CustomerName))]
```

Use multiple parameters and expressions:

```csharp
[AutoIncrement(nameof(CustomerName), "GetDate([QuoteDate])")]
```

📸 _[Screenshot Placeholder: Multi-Parameter Auto Increment]_

This approach ensures IDs increment based on filtered groups or contextual uniqueness.

#### WARNING

Starting with DevExpress Version 25.1, you should migrate to the new Llamachant.ExpressApp modules instead. Support for this module will end soon.
