Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Elsa.Extensions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "agents", "agents", "{0125BA
.github\agents\release-notes.agent.md = .github\agents\release-notes.agent.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.Dapper.Sqlite", "src\modules\persistence\Elsa.Persistence.Dapper.Sqlite\Elsa.Persistence.Dapper.Sqlite.csproj", "{1944944F-0F12-C21D-34BF-355DE6AE5C47}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.Dapper.SqlServer", "src\modules\persistence\Elsa.Persistence.Dapper.SqlServer\Elsa.Persistence.Dapper.SqlServer.csproj", "{849E5AE5-363C-BE84-F82E-031CD73C8C80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.Dapper.PostgreSql", "src\modules\persistence\Elsa.Persistence.Dapper.PostgreSql\Elsa.Persistence.Dapper.PostgreSql.csproj", "{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1456,6 +1462,42 @@ Global
{50798373-8A89-4159-BFD9-830D259538D6}.Release|x64.Build.0 = Release|Any CPU
{50798373-8A89-4159-BFD9-830D259538D6}.Release|x86.ActiveCfg = Release|Any CPU
{50798373-8A89-4159-BFD9-830D259538D6}.Release|x86.Build.0 = Release|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Debug|x64.ActiveCfg = Debug|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Debug|x64.Build.0 = Debug|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Debug|x86.ActiveCfg = Debug|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Debug|x86.Build.0 = Debug|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Release|Any CPU.Build.0 = Release|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Release|x64.ActiveCfg = Release|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Release|x64.Build.0 = Release|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Release|x86.ActiveCfg = Release|Any CPU
{1944944F-0F12-C21D-34BF-355DE6AE5C47}.Release|x86.Build.0 = Release|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Debug|x64.ActiveCfg = Debug|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Debug|x64.Build.0 = Debug|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Debug|x86.ActiveCfg = Debug|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Debug|x86.Build.0 = Debug|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Release|Any CPU.Build.0 = Release|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Release|x64.ActiveCfg = Release|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Release|x64.Build.0 = Release|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Release|x86.ActiveCfg = Release|Any CPU
{849E5AE5-363C-BE84-F82E-031CD73C8C80}.Release|x86.Build.0 = Release|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Debug|x64.ActiveCfg = Debug|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Debug|x64.Build.0 = Debug|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Debug|x86.ActiveCfg = Debug|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Debug|x86.Build.0 = Debug|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Release|Any CPU.Build.0 = Release|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Release|x64.ActiveCfg = Release|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Release|x64.Build.0 = Release|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Release|x86.ActiveCfg = Release|Any CPU
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1587,6 +1629,9 @@ Global
{65B9F528-568B-4E0E-894E-F22E0B7C64BB} = {6E46B8AD-FA47-474F-B959-0B530771C28C}
{50798373-8A89-4159-BFD9-830D259538D6} = {6E46B8AD-FA47-474F-B959-0B530771C28C}
{0125BAC5-45B7-4E9B-8A2B-55F075BF537A} = {D0212324-351E-4CA6-95EE-27754B5367CC}
{1944944F-0F12-C21D-34BF-355DE6AE5C47} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
{849E5AE5-363C-BE84-F82E-031CD73C8C80} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
{2A5DDC60-D1D4-4B03-92AC-A0F2F15007E2} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {11A771DA-B728-445E-8A88-AE1C84C3B3A6}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Elsa.Persistence.Dapper.Abstractions;

namespace Elsa.Persistence.Dapper.Dialects;
namespace Elsa.Persistence.Dapper.PostgreSql.Dialects;

/// <summary>
/// Represents a SQL Server dialect.
/// Represents a PostgreSQL dialect.
/// </summary>
public class PostgreSqlDialect : SqlDialectBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>
Provides Dapper implementations of PostgreSQL.
</Description>
<PackageTags>elsa extension module persistence dapper postgresql</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Elsa.Persistence.Dapper\Elsa.Persistence.Dapper.csproj"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Npgsql"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Data;
using Elsa.Persistence.Dapper.Contracts;
using Elsa.Persistence.Dapper.Dialects;
using Elsa.Persistence.Dapper.PostgreSql.Dialects;
using JetBrains.Annotations;
using Npgsql;

namespace Elsa.Persistence.Dapper.Services;
namespace Elsa.Persistence.Dapper.PostgreSql.Services;

/// <summary>
/// Provides a PostgreSql connection to the database.
Expand Down Expand Up @@ -44,5 +44,5 @@ public IDbConnection GetConnection()
}

/// <inheritdoc />
public ISqlDialect Dialect => new PostgreSqlDialect();
public ISqlDialect Dialect { get; } = new PostgreSqlDialect();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Elsa.Persistence.Dapper.Abstractions;

namespace Elsa.Persistence.Dapper.Dialects;
namespace Elsa.Persistence.Dapper.SqlServer.Dialects;

/// <summary>
/// Represents a SQL Server dialect.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>
Provides Dapper implementations of SQL Server.
</Description>
<PackageTags>elsa extension module persistence dapper sqlserver</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Elsa.Persistence.Dapper\Elsa.Persistence.Dapper.csproj"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Data;
using Elsa.Persistence.Dapper.Contracts;
using Elsa.Persistence.Dapper.Dialects;
using Elsa.Persistence.Dapper.SqlServer.Dialects;
using JetBrains.Annotations;
using Microsoft.Data.SqlClient;

namespace Elsa.Persistence.Dapper.Services;
namespace Elsa.Persistence.Dapper.SqlServer.Services;

/// <summary>
/// Provides a SQLite connection to the database.
/// Provides a SQL Server connection to the database.
/// </summary>
[PublicAPI]
public class SqlServerDbConnectionProvider : IDbConnectionProvider
Expand All @@ -29,9 +29,9 @@ public SqlServerDbConnectionProvider(string connectionString)
{
_connectionString = connectionString;
}

/// <inheritdoc />
public string GetConnectionString() =>_connectionString;
public string GetConnectionString() => _connectionString;

/// <inheritdoc />
public IDbConnection GetConnection()
Expand All @@ -43,5 +43,5 @@ public IDbConnection GetConnection()
}

/// <inheritdoc />
public ISqlDialect Dialect => new SqlServerDialect();
public ISqlDialect Dialect { get; } = new SqlServerDialect();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Elsa.Common.Models;
using Elsa.Persistence.Dapper.Abstractions;

namespace Elsa.Persistence.Dapper.Dialects;
namespace Elsa.Persistence.Dapper.Sqlite.Dialects;

/// <summary>
/// Represents a SQLite dialect.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>
Provides Dapper implementations of SQLite.
</Description>
<PackageTags>elsa extension module persistence dapper sqlite</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Elsa.Persistence.Dapper\Elsa.Persistence.Dapper.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite.Core" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Data;
using Dapper;
using Elsa.Persistence.Dapper.Contracts;
using Elsa.Persistence.Dapper.Dialects;
using Elsa.Persistence.Dapper.TypeHandlers.Sqlite;
using Elsa.Persistence.Dapper.Sqlite.Dialects;
using Elsa.Persistence.Dapper.Sqlite.TypeHandlers;
using JetBrains.Annotations;
using Microsoft.Data.Sqlite;

namespace Elsa.Persistence.Dapper.Services;
namespace Elsa.Persistence.Dapper.Sqlite.Services;

/// <summary>
/// Provides a SQLite connection to the database.
Expand All @@ -19,6 +19,7 @@ public class SqliteDbConnectionProvider : IDbConnectionProvider
static SqliteDbConnectionProvider()
{
// See: https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/dapper-limitations#data-types
SqlMapper.AddTypeHandler(new GuidHandler());
SqlMapper.AddTypeHandler(new DateTimeOffsetHandler());
SqlMapper.AddTypeHandler(new TimeSpanHandler());
}
Expand Down Expand Up @@ -52,5 +53,5 @@ public IDbConnection GetConnection()
}

/// <inheritdoc />
public ISqlDialect Dialect => new SqliteDialect();
public ISqlDialect Dialect { get; } = new SqliteDialect();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Elsa.Persistence.Dapper.TypeHandlers.Sqlite;
namespace Elsa.Persistence.Dapper.Sqlite.TypeHandlers;

/// <summary>
/// Represents a SQLite type handler for <see cref="DateTimeOffset"/>.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Elsa.Persistence.Dapper.TypeHandlers.Sqlite;
namespace Elsa.Persistence.Dapper.Sqlite.TypeHandlers;

/// <summary>
/// Represents a SQLite type handler for <see cref="Guid"/>.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Data;
using Dapper;

namespace Elsa.Persistence.Dapper.TypeHandlers.Sqlite;
namespace Elsa.Persistence.Dapper.Sqlite.TypeHandlers;

/// <summary>
/// Represents a SQLite type handler.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Elsa.Persistence.Dapper.TypeHandlers.Sqlite;
namespace Elsa.Persistence.Dapper.Sqlite.TypeHandlers;

/// <summary>
/// Represents a SQLite type handler for <see cref="TimeSpan"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Elsa.Persistence.Dapper.Abstractions;

/// <summary>
/// Provides a base implementation of <see cref="ISqlDialect"/>, where the dialect defaults to SQLite.
/// Provides a base implementation of <see cref="ISqlDialect"/>, where the dialect defaults to SQL Server.
/// </summary>
public abstract class SqlDialectBase : ISqlDialect
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity"/>
<PackageReference Include="Dapper"/>
<PackageReference Include="FluentMigrator"/>
<PackageReference Include="FluentMigrator.Runner.Core"/>
<PackageReference Include="Microsoft.Data.Sqlite.Core"/>
<PackageReference Include="Microsoft.Data.SqlClient"/>
<PackageReference Include="Microsoft.Identity.Client"/>
<PackageReference Include="Npgsql"/>
<PackageReference Include="System.Formats.Asn1"/>
<PackageReference Include="Dapper" />
<PackageReference Include="FluentMigrator" />
<PackageReference Include="FluentMigrator.Runner.Core" />
</ItemGroup>

<ItemGroup Label="Elsa" Condition="'$(UseProjectReferences)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using Dapper;
using Elsa.Persistence.Dapper.Contracts;
using Elsa.Persistence.Dapper.Services;
using Elsa.Persistence.Dapper.TypeHandlers.Sqlite;
using Elsa.Features.Abstractions;
using Elsa.Features.Services;
using Elsa.Persistence.Dapper.Contracts;
using Microsoft.Extensions.DependencyInjection;

namespace Elsa.Persistence.Dapper.Features;
Expand All @@ -16,14 +13,12 @@ public class DapperFeature : FeatureBase
/// <inheritdoc />
public DapperFeature(IModule module) : base(module)
{
// See: https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/dapper-limitations#data-types
SqlMapper.AddTypeHandler(new GuidHandler());
}

/// <summary>
/// Gets or sets a factory that provides an <see cref="IDbConnectionProvider"/> instance.
/// </summary>
public Func<IServiceProvider, IDbConnectionProvider> DbConnectionProvider { get; set; } = _ => new SqliteDbConnectionProvider();
public Func<IServiceProvider, IDbConnectionProvider> DbConnectionProvider { get; set; }

/// <inheritdoc />
public override void Apply()
Expand Down
3 changes: 3 additions & 0 deletions src/workbench/Elsa.Server.Web/Elsa.Server.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
<ProjectReference Include="..\..\modules\email\Elsa.Email\Elsa.Email.csproj" />
<ProjectReference Include="..\..\modules\http\Elsa.Http.Webhooks\Elsa.Http.Webhooks.csproj" />
<ProjectReference Include="..\..\modules\persistence\Elsa.Persistence.Dapper.Migrations\Elsa.Persistence.Dapper.Migrations.csproj" />
<ProjectReference Include="..\..\modules\persistence\Elsa.Persistence.Dapper.PostgreSql\Elsa.Persistence.Dapper.PostgreSql.csproj" />
<ProjectReference Include="..\..\modules\persistence\Elsa.Persistence.Dapper.Sqlite\Elsa.Persistence.Dapper.Sqlite.csproj" />
<ProjectReference Include="..\..\modules\persistence\Elsa.Persistence.Dapper.SqlServer\Elsa.Persistence.Dapper.SqlServer.csproj" />
<ProjectReference Include="..\..\modules\persistence\Elsa.Persistence.Dapper\Elsa.Persistence.Dapper.csproj" />
<ProjectReference Include="..\..\modules\persistence\Elsa.Persistence.MongoDb\Elsa.Persistence.MongoDb.csproj" />
<ProjectReference Include="..\..\modules\retention\Elsa.Retention\Elsa.Retention.csproj" />
Expand Down
3 changes: 2 additions & 1 deletion src/workbench/Elsa.Server.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
using Elsa.OpenTelemetry.Middleware;
using Elsa.Persistence.Dapper.Extensions;
using Elsa.Persistence.Dapper.Contracts;
using Elsa.Persistence.Dapper.Services;
using Elsa.Persistence.Dapper.Sqlite.Services;
using Elsa.Persistence.Dapper.SqlServer.Services;
using Elsa.Persistence.EFCore.Extensions;
using Elsa.Persistence.EFCore.Modules.Alterations;
using Elsa.Persistence.EFCore.Modules.Identity;
Expand Down