Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>EntityFrameworkCore.Ydb.Yandex.Cloud</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,11 +11,10 @@ await Parser.Default.ParseArguments<CmdOptions>(args).WithParsedAsync(async cmd
var saProvider = new ServiceAccountProvider(saFilePath: cmd.SaFilePath, loggerFactory: loggerFactory);

var options = new DbContextOptionsBuilder<AppDbContext>()
.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);
Expand Down
14 changes: 14 additions & 0 deletions examples/src/EntityFrameworkCore.Ydb.Yandex.Cloud/README.md
Original file line number Diff line number Diff line change
@@ -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=<host>;Port=2135;Database=<database>" --saFilePath "<path/to/SaKey.json>"
```

Required options:

1. `connectionString` - Connection string in ADO.NET format: `Key1=Value1;Key2=Value2;...`.
2. `saFilePath` - path to the service account key.
10 changes: 5 additions & 5 deletions examples/src/YdbExamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading