Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added SqlServerClientSpark #6

Merged
merged 2 commits into from
Jun 15, 2024
Merged
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
60 changes: 60 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Set default behavior to automatically normalize line endings.
* text=auto

# Collapse these files in PRs by default
*.xlf linguist-generated=true
*.lcl linguist-generated=true

*.jpg binary
*.png binary
*.gif binary

# Force bash scripts to always use lf line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.in text eol=lf
*.sh text eol=lf

# Likewise, force cmd and batch scripts to always use crlf
*.cmd text eol=crlf
*.bat text eol=crlf

*.cs text=auto diff=csharp
*.vb text=auto
*.resx text=auto
*.c text=auto
*.cpp text=auto
*.cxx text=auto
*.h text=auto
*.hxx text=auto
*.py text=auto
*.rb text=auto
*.java text=auto
*.html text=auto
*.htm text=auto
*.css text=auto
*.scss text=auto
*.sass text=auto
*.less text=auto
*.js text=auto
*.lisp text=auto
*.clj text=auto
*.sql text=auto
*.php text=auto
*.lua text=auto
*.m text=auto
*.asm text=auto
*.erl text=auto
*.fs text=auto
*.fsx text=auto
*.hs text=auto

*.csproj text=auto
*.vbproj text=auto
*.fsproj text=auto
*.dbproj text=auto
*.sln text=auto eol=crlf

# Set linguist language for .h files explicitly based on
# https://github.com/github/linguist/issues/1626#issuecomment-401442069
# this only affects the repo's language statistics
*.h linguist-language=C
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
ci:
name: CI - Build and Test
name: CI
runs-on: ubuntu-latest
steps:

Expand Down
25 changes: 23 additions & 2 deletions ES.FX.sln
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ES.FX.Ignite.Microsoft.Enti
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ES.FX.Ignite.Microsoft.EntityFrameworkCore.Tests", "tests\ES.FX.Ignite.Microsoft.EntityFrameworkCore.Tests\ES.FX.Ignite.Microsoft.EntityFrameworkCore.Tests.csproj", "{0AAE113B-7D85-477C-A72C-55B8C8BED049}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES.FX.Ignite.Spark.Tests", "tests\ES.FX.Ignite.Spark.Tests\ES.FX.Ignite.Spark.Tests.csproj", "{E0F4DFC2-46E3-4EF6-AA9D-71F0B73911D3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ES.FX.Ignite.Spark.Tests", "tests\ES.FX.Ignite.Spark.Tests\ES.FX.Ignite.Spark.Tests.csproj", "{E0F4DFC2-46E3-4EF6-AA9D-71F0B73911D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES.FX.Shared.SqlServer.Tests", "tests\ES.FX.Shared.SqlServer.Tests\ES.FX.Shared.SqlServer.Tests.csproj", "{938AE7EF-E227-4EED-912D-43A9AEF614B5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ES.FX.Shared.SqlServer.Tests", "tests\ES.FX.Shared.SqlServer.Tests\ES.FX.Shared.SqlServer.Tests.csproj", "{938AE7EF-E227-4EED-912D-43A9AEF614B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES.FX.Ignite.Microsoft.Data.SqlClient", "src\ES.FX.Ignite.Microsoft.Data.SqlClient\ES.FX.Ignite.Microsoft.Data.SqlClient.csproj", "{DB1966F4-AF4B-4E04-97FD-01F0E994EDA0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ES.FX.Microsoft.Data.SqlClient", "src\ES.FX.Microsoft.Data.SqlClient\ES.FX.Microsoft.Data.SqlClient.csproj", "{EDFC5F9A-F0F6-46E0-A3DC-9B81F5115327}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES.FX.Ignite.Microsoft.Data.SqlClient.Tests", "tests\ES.FX.Ignite.Microsoft.Data.SqlClient.Tests\ES.FX.Ignite.Microsoft.Data.SqlClient.Tests.csproj", "{F78162A1-433B-4245-99FB-6C0B9E7B05C0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -156,6 +162,18 @@ Global
{938AE7EF-E227-4EED-912D-43A9AEF614B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{938AE7EF-E227-4EED-912D-43A9AEF614B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{938AE7EF-E227-4EED-912D-43A9AEF614B5}.Release|Any CPU.Build.0 = Release|Any CPU
{DB1966F4-AF4B-4E04-97FD-01F0E994EDA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB1966F4-AF4B-4E04-97FD-01F0E994EDA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB1966F4-AF4B-4E04-97FD-01F0E994EDA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB1966F4-AF4B-4E04-97FD-01F0E994EDA0}.Release|Any CPU.Build.0 = Release|Any CPU
{EDFC5F9A-F0F6-46E0-A3DC-9B81F5115327}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDFC5F9A-F0F6-46E0-A3DC-9B81F5115327}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDFC5F9A-F0F6-46E0-A3DC-9B81F5115327}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDFC5F9A-F0F6-46E0-A3DC-9B81F5115327}.Release|Any CPU.Build.0 = Release|Any CPU
{F78162A1-433B-4245-99FB-6C0B9E7B05C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F78162A1-433B-4245-99FB-6C0B9E7B05C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F78162A1-433B-4245-99FB-6C0B9E7B05C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F78162A1-433B-4245-99FB-6C0B9E7B05C0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -187,6 +205,9 @@ Global
{0AAE113B-7D85-477C-A72C-55B8C8BED049} = {32548940-0629-46AC-B9BF-E7C41F1C49DE}
{E0F4DFC2-46E3-4EF6-AA9D-71F0B73911D3} = {32548940-0629-46AC-B9BF-E7C41F1C49DE}
{938AE7EF-E227-4EED-912D-43A9AEF614B5} = {BD8EB348-8F5D-41BB-BA2E-6D5C7A71FAB5}
{DB1966F4-AF4B-4E04-97FD-01F0E994EDA0} = {5A5969AF-86CB-489B-B0DE-C0BAADF5B424}
{EDFC5F9A-F0F6-46E0-A3DC-9B81F5115327} = {F8538BCE-36D3-4317-8C3C-7540117B99A7}
{F78162A1-433B-4245-99FB-6C0B9E7B05C0} = {32548940-0629-46AC-B9BF-E7C41F1C49DE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {388473D0-FE20-4821-BFE4-C3CD3E184C8F}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\ES.FX.Hosting\ES.FX.Hosting.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Hosting\ES.FX.Ignite.Hosting.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Microsoft.EntityFrameworkCore.SqlServer\ES.FX.Ignite.Microsoft.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Migrations\ES.FX.Ignite.Migrations.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Serilog\ES.FX.Ignite.Serilog.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Serilog\ES.FX.Serilog.csproj" />
<ProjectReference Include="..\Playground.Shared.Data.Simple.EntityFrameworkCore.SqlServer\Playground.Shared.Data.Simple.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\Playground.Shared.Data.Simple.EntityFrameworkCore\Playground.Shared.Data.Simple.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ES.FX.Hosting\ES.FX.Hosting.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Hosting\ES.FX.Ignite.Hosting.csproj" />
<ProjectReference
Include="..\..\src\ES.FX.Ignite.Microsoft.EntityFrameworkCore.SqlServer\ES.FX.Ignite.Microsoft.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Migrations\ES.FX.Ignite.Migrations.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Ignite.Serilog\ES.FX.Ignite.Serilog.csproj" />
<ProjectReference Include="..\..\src\ES.FX.Serilog\ES.FX.Serilog.csproj" />
<ProjectReference
Include="..\Playground.Shared.Data.Simple.EntityFrameworkCore.SqlServer\Playground.Shared.Data.Simple.EntityFrameworkCore.SqlServer.csproj" />
<ProjectReference
Include="..\Playground.Shared.Data.Simple.EntityFrameworkCore\Playground.Shared.Data.Simple.EntityFrameworkCore.csproj" />
</ItemGroup>

</Project>
</Project>
5 changes: 5 additions & 0 deletions playground/Playground.Microservice.Api.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using ES.FX.Ignite.Migrations.Hosting;
using ES.FX.Ignite.Serilog.Hosting;
using ES.FX.Serilog.Lifetime;
using Microsoft.Data.SqlClient;
using Playground.Microservice.Api.Host.HostedServices;
using Playground.Shared.Data.Simple.EntityFrameworkCore;
using Playground.Shared.Data.Simple.EntityFrameworkCore.SqlServer;
Expand All @@ -28,9 +29,13 @@

builder.Services.AddHostedService<TestHostedService>();


builder.Services.AddKeyedSingleton<SqlConnection>(null, (sp, key) => { return new SqlConnection("nothing"); });

var app = builder.Build();
app.UseIgnite();

app.Services.GetRequiredService<SqlConnection>();

await app.RunAsync();
return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.Data.SqlClient;

namespace ES.FX.Ignite.Microsoft.Data.SqlClient.Configuration;

/// <summary>
/// Provides the options for connecting to a SQL Server database using a <see cref="SqlConnection" />
/// </summary>
public class SqlServerClientSparkOptions
{
/// <summary>
/// The connection string of the SQL server database to connect to.
/// </summary>
public string? ConnectionString { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Data.SqlClient;

namespace ES.FX.Ignite.Microsoft.Data.SqlClient.Configuration;

/// <summary>
/// Provides the settings for connecting to a SQL Server database using a <see cref="SqlConnection" />
/// </summary>
public class SqlServerClientSparkSettings
{
/// <summary>
/// Gets or sets a boolean value that indicates whether the database health check is disabled or not.
/// </summary>
public bool DisableHealthChecks { get; set; }

/// <summary>
/// Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not.
/// </summary>
public bool DisableTracing { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="8.0.2" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.8.0-beta.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ES.FX.Ignite.Spark\ES.FX.Ignite.Spark.csproj" />
<ProjectReference Include="..\ES.FX.Microsoft.Data.SqlClient\ES.FX.Microsoft.Data.SqlClient.csproj" />
</ItemGroup>

</Project>
Loading