# TraconSqliteBuilderExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.traconsqlitebuilderextensions/
> Summary: TraconSqliteBuilderExtensions: Extensions that add SQLite persistence to the Tracon chain.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Sqlite.dll</code></div>

Extensions that add SQLite persistence to the Tracon chain.

```csharp
public static class TraconSqliteBuilderExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.traconsqlitebuilderextensions/">TraconSqliteBuilderExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Methods

### <a id="Tracon_TraconSqliteBuilderExtensions_UseSqlite_Tracon_ITraconBuilder_System_String_"></a> UseSqlite\(ITraconBuilder, string\)

Enables SQLite persistence by giving a connection string.

```csharp
public static ITraconBuilder UseSqlite(this ITraconBuilder builder, string connectionString)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon chain.

`connectionString` [string](https://learn.microsoft.com/dotnet/api/system.string)

The SQLite connection string (example: `Data Source=tracon.db`).

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

```csharp
builder.AddTracon()
       .UseSqlite("Data Source=tracon.db");
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`connectionString` is empty.

### <a id="Tracon_TraconSqliteBuilderExtensions_UseSqlite_Tracon_ITraconBuilder_Microsoft_Extensions_Configuration_IConfiguration_"></a> UseSqlite\(ITraconBuilder, IConfiguration\)

Enables SQLite persistence, reading settings from the `Tracon:Sqlite` section.

```csharp
public static ITraconBuilder UseSqlite(this ITraconBuilder builder, IConfiguration configurationSection)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon chain.

`configurationSection` [IConfiguration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration)

The section settings are read from. Usually
`configuration.GetSection(TraconSqliteOptions.SectionName)`.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

One of the parameters is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

### <a id="Tracon_TraconSqliteBuilderExtensions_UseSqlite_Tracon_ITraconBuilder_System_Action_Tracon_TraconSqliteOptions__"></a> UseSqlite\(ITraconBuilder, Action<TraconSqliteOptions\>\)

Enables SQLite persistence by giving settings in code.

```csharp
public static ITraconBuilder UseSqlite(this ITraconBuilder builder, Action<TraconSqliteOptions> configure)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon chain.

`configure` [Action](https://learn.microsoft.com/dotnet/api/system.action\-1)<[TraconSqliteOptions](/api/tracon.traconsqliteoptions/)\>

The settings mutator.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

Stores are registered with `ServiceCollectionDescriptorExtensions.Replace`,
not `TryAdd`; the reason is the same as for `UseSqlServer`/`UsePostgreSql`

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

One of the parameters is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).
