diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee4c8942..b0de63b0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - ydb-version: [ 'trunk', 'latest' ] + ydb-version: [ 'latest', '25.1' ] dotnet-version: [ 6.0.x, 7.0.x ] include: - dotnet-version: 6.0.x diff --git a/examples/src/EF_YC/CmdOptions.cs b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/CmdOptions.cs similarity index 63% rename from examples/src/EF_YC/CmdOptions.cs rename to examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/CmdOptions.cs index 0a98fc9a..d23b182b 100644 --- a/examples/src/EF_YC/CmdOptions.cs +++ b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/CmdOptions.cs @@ -1,10 +1,10 @@ using CommandLine; -namespace EF_YC; +namespace EntityFrameworkCore.Ydb.Yandex.Cloud; internal class CmdOptions { - [Option('c', "connectionString", Required = true, HelpText = "Connection string")] + [Option("connectionString", Required = true, HelpText = "Connection string")] public string ConnectionString { get; set; } = null!; [Option("saFilePath", Required = true, HelpText = "Sa Key")] diff --git a/examples/src/EF_YC/EF_YC.csproj b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/EntityFrameworkCore.Ydb.Yandex.Cloud.csproj similarity index 91% rename from examples/src/EF_YC/EF_YC.csproj rename to examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/EntityFrameworkCore.Ydb.Yandex.Cloud.csproj index d5eaa1ea..7c01b52e 100644 --- a/examples/src/EF_YC/EF_YC.csproj +++ b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/EntityFrameworkCore.Ydb.Yandex.Cloud.csproj @@ -5,6 +5,7 @@ net8.0 enable enable + EntityFrameworkCore.Ydb.Yandex.Cloud diff --git a/examples/src/EF_YC/Program.cs b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/Program.cs similarity index 86% rename from examples/src/EF_YC/Program.cs rename to examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/Program.cs index 9d4fc7b8..abce795c 100644 --- a/examples/src/EF_YC/Program.cs +++ b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/Program.cs @@ -1,6 +1,6 @@ using CommandLine; -using EF_YC; using EntityFrameworkCore.Ydb.Extensions; +using EntityFrameworkCore.Ydb.Yandex.Cloud; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ydb.Sdk.Yc; @@ -11,11 +11,10 @@ await Parser.Default.ParseArguments(args).WithParsedAsync(async cmd var saProvider = new ServiceAccountProvider(saFilePath: cmd.SaFilePath, loggerFactory: loggerFactory); var options = new DbContextOptionsBuilder() - .UseYdb(cmd.ConnectionString, builder => - { - builder.WithCredentialsProvider(saProvider); - builder.WithServerCertificates(YcCerts.GetYcServerCertificates()); - }) + .UseYdb(cmd.ConnectionString, builder => builder + .WithCredentialsProvider(saProvider) + .WithServerCertificates(YcCerts.GetYcServerCertificates()) + ) .Options; await using var db = new AppDbContext(options); diff --git a/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/README.md b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/README.md new file mode 100644 index 00000000..bbd19036 --- /dev/null +++ b/examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/README.md @@ -0,0 +1,14 @@ +# Entity Framework Core YDB to Yandex Cloud Example + +A sample application that defines a model, populates it with data, and then queries a database in Yandex Cloud. + +## Running + +```dotnet +dotnet run --connectionString "UseTls=true;Host=;Port=2135;Database=" --saFilePath "" +``` + +Required options: + +1. `connectionString` - Connection string in ADO.NET format: `Key1=Value1;Key2=Value2;...`. +2. `saFilePath` - path to the service account key. diff --git a/examples/src/YdbExamples.sln b/examples/src/YdbExamples.sln index 9d9e3445..df0bcce6 100644 --- a/examples/src/YdbExamples.sln +++ b/examples/src/YdbExamples.sln @@ -19,7 +19,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Topic", "Topic\Topic.csproj EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EF", "EF\EF.csproj", "{0CE9DF93-1411-4E73-BA88-A66018FAB948}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EF_YC", "EF_YC\EF_YC.csproj", "{31A2E7BF-45BB-4C63-9DEC-58DD06491EF1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.Ydb.Yandex.Cloud", "EntityFrameworkCore.Ydb.Yandex.Cloud\EntityFrameworkCore.Ydb.Yandex.Cloud.csproj", "{8F7266C7-75BB-4753-9FB2-BDF4678AF73B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -59,10 +59,10 @@ Global {0CE9DF93-1411-4E73-BA88-A66018FAB948}.Debug|Any CPU.Build.0 = Debug|Any CPU {0CE9DF93-1411-4E73-BA88-A66018FAB948}.Release|Any CPU.ActiveCfg = Release|Any CPU {0CE9DF93-1411-4E73-BA88-A66018FAB948}.Release|Any CPU.Build.0 = Release|Any CPU - {31A2E7BF-45BB-4C63-9DEC-58DD06491EF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {31A2E7BF-45BB-4C63-9DEC-58DD06491EF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {31A2E7BF-45BB-4C63-9DEC-58DD06491EF1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {31A2E7BF-45BB-4C63-9DEC-58DD06491EF1}.Release|Any CPU.Build.0 = Release|Any CPU + {8F7266C7-75BB-4753-9FB2-BDF4678AF73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F7266C7-75BB-4753-9FB2-BDF4678AF73B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F7266C7-75BB-4753-9FB2-BDF4678AF73B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F7266C7-75BB-4753-9FB2-BDF4678AF73B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE