Add project files.

This commit is contained in:
2025-08-18 17:11:43 +03:30
parent 807dc263be
commit e5eb10d604
3943 changed files with 223719 additions and 0 deletions
@@ -0,0 +1,15 @@
using Elsa.EntityFrameworkCore.Abstractions;
using Elsa.EntityFrameworkCore.Extensions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
namespace Elsa.Connections.Persistence.EntityFrameworkCore.Sqlite;
[UsedImplicitly]
public class SqliteConnectionDbContextFactory : DesignTimeDbContextFactoryBase<ConnectionDbContext>
{
protected override void ConfigureBuilder(DbContextOptionsBuilder<ConnectionDbContext> builder, string connectionString)
{
builder.UseElsaSqlite(GetType().Assembly, connectionString);
}
}
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Provides an EF Core migrations for SQLite for the Connection Persistence module.</Description>
<PackageTags>elsa module persistence efcore entity framework core sqlite</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elsa.Connections.Persistence.EntityFrameworkCore\Elsa.Connections.Persistence.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Elsa.EntityFrameworkCore.Sqlite\Elsa.EntityFrameworkCore.Sqlite.csproj" />
</ItemGroup>
</Project>
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
@@ -0,0 +1,60 @@
// <auto-generated />
using Elsa.Connections.Persistence.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Elsa.Connections.Persistence.EntityFrameworkCore.Sqlite.Migrations
{
[DbContext(typeof(ConnectionDbContext))]
[Migration("20250212220543_V3_3")]
partial class V3_3
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Elsa")
.HasAnnotation("ProductVersion", "8.0.12");
modelBuilder.Entity("Elsa.Connections.Persistence.Entities.ConnectionDefinition", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConnectionConfiguration")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ConnectionType")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name")
.HasDatabaseName("IX_ConnectionDefinition_Name");
b.HasIndex("TenantId")
.HasDatabaseName("IX_ConnectionDefinition_TenantId");
b.ToTable("ConnectionDefinitions", "Elsa");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,62 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Elsa.Connections.Persistence.EntityFrameworkCore.Sqlite.Migrations
{
/// <inheritdoc />
public partial class V3_3 : Migration
{
private readonly Elsa.EntityFrameworkCore.IElsaDbContextSchema _schema;
/// <inheritdoc />
public V3_3(Elsa.EntityFrameworkCore.IElsaDbContextSchema schema)
{
_schema = schema;
}
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: _schema.Schema);
migrationBuilder.CreateTable(
name: "ConnectionDefinitions",
schema: _schema.Schema,
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: true),
ConnectionConfiguration = table.Column<string>(type: "TEXT", nullable: false),
ConnectionType = table.Column<string>(type: "TEXT", nullable: false),
TenantId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ConnectionDefinitions", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_ConnectionDefinition_Name",
schema: _schema.Schema,
table: "ConnectionDefinitions",
column: "Name");
migrationBuilder.CreateIndex(
name: "IX_ConnectionDefinition_TenantId",
schema: _schema.Schema,
table: "ConnectionDefinitions",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ConnectionDefinitions",
schema: _schema.Schema);
}
}
}
@@ -0,0 +1,57 @@
// <auto-generated />
using Elsa.Connections.Persistence.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Elsa.Connections.Persistence.EntityFrameworkCore.Sqlite.Migrations
{
[DbContext(typeof(ConnectionDbContext))]
partial class ConnectionDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Elsa")
.HasAnnotation("ProductVersion", "8.0.12");
modelBuilder.Entity("Elsa.Connections.Persistence.Entities.ConnectionDefinition", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConnectionConfiguration")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ConnectionType")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name")
.HasDatabaseName("IX_ConnectionDefinition_Name");
b.HasIndex("TenantId")
.HasDatabaseName("IX_ConnectionDefinition_TenantId");
b.ToTable("ConnectionDefinitions", "Elsa");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,28 @@
using System.Reflection;
using Elsa.Connections.Persistence.EntityFrameworkCore;
// ReSharper disable once CheckNamespace
namespace Elsa.EntityFrameworkCore.Extensions;
/// <summary>
/// Provides extensions to configure EF Core to use Sqlite.
/// </summary>
public static class ConnectionsSqliteProvidersExtensions
{
private static Assembly Assembly => typeof(ConnectionsSqliteProvidersExtensions).Assembly;
/// <summary>
/// Configures the feature to use Sqlite.
/// </summary>
public static EFCoreConnectionPersistenceFeature UseSqlite(this EFCoreConnectionPersistenceFeature feature, string? connectionString = null, ElsaDbContextOptions? options = null)
{
feature.UseSqlite(Assembly, connectionString, options);
return feature;
}
public static EFCoreConnectionPersistenceFeature UseSqlite(this EFCoreConnectionPersistenceFeature feature, Func<IServiceProvider, string> connectionStringFunc, ElsaDbContextOptions? options = null)
{
feature.UseSqlite(Assembly, connectionStringFunc, options);
return feature;
}
}
@@ -0,0 +1 @@
ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.IElsaDbContextSchema --efOptions "migrations add V3_3 -c ConnectionDbContext -o Migrations"