Skip to content

Commit 73ee5b6

Browse files
committed
Merge branch 'main' into work/somefix
2 parents 7cf998c + 71001da commit 73ee5b6

File tree

121 files changed

+345
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+345
-302
lines changed

.github/scripts/publish-ef.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
CHANGELOG=$(cat $CHANGELOG_FILE | sed -e '/^## v.*$/,$d')
5+
if [[ -z "$CHANGELOG" ]]
6+
then
7+
echo "CHANGELOG empty"
8+
exit 1;
9+
fi;
10+
11+
LAST_EF_TAG=$(git tag --sort=-creatordate --list 'ef-*' | head -n 1 | cut -d '-' -f 2);
12+
LAST_EF_TAG=${LAST_EF_TAG:-v0.0.0}
13+
MAJOR=$(echo $LAST_EF_TAG | sed -E 's/v([0-9]+)\..*/\1/');
14+
MINOR=$(echo $LAST_EF_TAG | sed -E 's/v[0-9]+\.([0-9]+)\..*/\1/');
15+
PATCH=$(echo $LAST_EF_TAG | sed -E 's/v[0-9]+\.[0-9]+\.([0-9]+)($|-rc[0-9]+)/\1/');
16+
RC=0;
17+
18+
if [ "$RELEASE_CANDIDATE" = true ]
19+
then
20+
RC=$(git tag | grep "ef-v$MAJOR.$MINOR.$PATCH-rc" | wc -l | xargs || true);
21+
fi
22+
if [ "$VERSION_CHANGE" = "MINOR" ] && [ $RC = 0 ]
23+
then
24+
MINOR=$((MINOR+1));
25+
PATCH=0;
26+
fi;
27+
if [ "$VERSION_CHANGE" = "PATCH" ] && [ $RC = 0 ]
28+
then
29+
PATCH=$((PATCH+1));
30+
fi;
31+
if [ "$RELEASE_CANDIDATE" = true ]
32+
then
33+
VERSION="$MAJOR.$MINOR.$PATCH-rc$RC";
34+
else
35+
VERSION="$MAJOR.$MINOR.$PATCH";
36+
fi;
37+
38+
TAG="v$VERSION"
39+
echo -e "## $TAG\n" >> $CHANGELOG_FILE.tmp
40+
cat $CHANGELOG_FILE >> $CHANGELOG_FILE.tmp
41+
mv $CHANGELOG_FILE.tmp $CHANGELOG_FILE;
42+
git add $CHANGELOG_FILE;
43+
git config --global user.email "robot@umbrella";
44+
git config --global user.name "robot";
45+
git commit -m "Release EF $TAG";
46+
git tag "ef-$TAG"
47+
git push --tags && git push
48+
CHANGELOG="$CHANGELOG
49+
50+
Full Changelog: [$LAST_EF_TAG...$TAG](https://github.com/ydb-platform/ydb-dotnet-sdk/compare/$LAST_EF_TAG...$TAG)"
51+
52+
cd src/EFCore.Ydb/src
53+
dotnet pack -c Release -o out /p:Version=$VERSION
54+
gh release create $TAG -t "ef-$TAG" --notes "$CHANGELOG"
55+
dotnet nuget push out/EntityFrameworkCore.Ydb.$VERSION.nupkg --skip-duplicate --api-key $NUGET_TOKEN --source https://api.nuget.org/v3/index.json

.github/scripts/publish.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ if [ "$RELEASE_CANDIDATE" = true ]
3131
then
3232
VERSION="$MAJOR.$MINOR.$PATCH-rc$RC";
3333
else
34-
sed -e "s/Minor = [0-9]*/Minor = $MINOR/g" -i $VERSION_FILE
35-
sed -e "s/Patch = [0-9]*/Patch = $PATCH/g" -i $VERSION_FILE
36-
git add $VERSION_FILE;
3734
VERSION="$MAJOR.$MINOR.$PATCH";
3835
fi;
3936
TAG="v$VERSION"

.github/workflows/publish-ef.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: publish
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version-change:
6+
description: Version part
7+
required: true
8+
type: choice
9+
options:
10+
- PATCH
11+
- MINOR
12+
release-candidate:
13+
description: Release candidate
14+
required: true
15+
type: boolean
16+
default: True
17+
18+
permissions:
19+
contents: write
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
env:
25+
VERSION_CHANGE: ${{ github.event.inputs.version-change }}
26+
RELEASE_CANDIDATE: ${{ github.event.inputs.release-candidate }}
27+
CHANGELOG_FILE: ./src/EFCore.Ydb/CHANGELOG.md
28+
GITHUB_TOKEN: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
29+
NUGET_TOKEN: ${{ secrets.YDB_PLATFORM_NUGET_TOKEN }}
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
35+
fetch-depth: 0
36+
- name: Setup dotnet
37+
uses: actions/setup-dotnet@v4
38+
with:
39+
dotnet-version: 8.0.x
40+
- name: Build
41+
run: |
42+
cd src/EFCore.Ydb/src
43+
dotnet build --configuration Release
44+
- name: Publish
45+
run: bash .github/scripts/publish-ef.sh
46+

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
env:
2525
VERSION_CHANGE: ${{ github.event.inputs.version-change }}
2626
RELEASE_CANDIDATE: ${{ github.event.inputs.release-candidate }}
27-
VERSION_FILE: src/Ydb.Sdk/src/Version.cs
2827
CHANGELOG_FILE: CHANGELOG.md
2928
GITHUB_TOKEN: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
3029
NUGET_TOKEN: ${{ secrets.YDB_PLATFORM_NUGET_TOKEN }}

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
with:
9595
dotnet-version: ${{ matrix.dotnet-version }}
9696
- name: Run Topic tests
97-
run: dotnet test src/Ydb.Sdk/tests/Tests.csproj --filter "FullyQualifiedName~Topic" -f ${{ matrix.dotnet-target-framework }} -l "console;verbosity=detailed"
97+
run: dotnet test src/Ydb.Sdk/tests/Tests.csproj --filter "FullyQualifiedName~Topic" -f ${{ matrix.dotnet-target-framework }} -l "console;verbosity=detailed"
9898
efcore-functional-tests:
9999
runs-on: ubuntu-22.04
100100
strategy:
@@ -118,8 +118,8 @@ jobs:
118118
uses: actions/setup-dotnet@v4
119119
with:
120120
dotnet-version: 9.0.x
121-
- name: Run EfCore tests
122-
run: dotnet test src/EfCore.Ydb/test/EfCore.Ydb.FunctionalTests/EfCore.Ydb.FunctionalTests.csproj -l "console;verbosity=detailed"
121+
- name: Run EFCore tests
122+
run: dotnet test src/EFCore.Ydb/test/EntityFrameworkCore.Ydb.FunctionalTests/EntityFrameworkCore.Ydb.FunctionalTests.csproj -l "console;verbosity=detailed"
123123
integration-tests:
124124
runs-on: ubuntu-22.04
125125
strategy:

README.md

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Provides an ADO.NET standard implementation for working with YDB, as well as nat
99
## Features
1010

1111
- **ADO.NET**: Full support for standard ADO.NET interfaces including DbConnection, DbCommand, DbDataReader, and more. This allows you to use familiar methods and patterns for database operations while leveraging the power and flexibility of YDB.
12-
- **QueryClient**: A lightweight, high-performance native client for direct interaction with YDB tables.
1312

1413
## Versioning
1514

@@ -64,64 +63,6 @@ while (await ydbDataReader.ReadAsync())
6463
}
6564
```
6665

67-
## Usage Native clients
68-
69-
To begin your work with YDB, create an instance of `Ydb.Sdk.Driver` class:
70-
```c#
71-
var config = new DriverConfig(
72-
endpoint: endpoint, // Database endpoint, "grpcs://host:port"
73-
database: database, // Full database path
74-
credentials: credentialsProvider // Credentials provider, see "Credentials" section
75-
);
76-
77-
using var driver = new Driver(
78-
config: config,
79-
loggerFactory: loggerFactory
80-
);
81-
82-
await driver.Initialize(); // Make sure to await driver initialization
83-
```
84-
85-
After you have driver instance, you can use it to create clients for different YDB services.
86-
87-
### Credentials
88-
YDB SDK provides several standard ways for authentication:
89-
1) `Ydb.Sdk.Auth.AnonymousProvider`. Anonymous YDB access, mainly for tests purposes.
90-
2) `Ydb.Sdk.Auth.TokenProvider`. Token authentication for OAuth-like tokens.
91-
3) `Ydb.Sdk.Auth.StaticCredentialsProvider`. Username and password based authentication.
92-
93-
For Yandex.Cloud specific authentication methods, consider using **[ydb-dotnet-yc](https://github.com/ydb-platform/ydb-dotnet-yc)**.
94-
95-
### QueryClient
96-
97-
Example of using a query client to execute a simple query:
98-
99-
```c#
100-
// Create QueryClient using Driver instance.
101-
using var queryClient = new QueryClient(driver);
102-
103-
var row = await queryClient.ReadRow(@"
104-
DECLARE $id AS Uint64;
105-
106-
SELECT
107-
series_id,
108-
title,
109-
release_date
110-
FROM series
111-
WHERE series_id = $id;
112-
",
113-
new Dictionary<string, YdbValue>
114-
{
115-
{ "$id", YdbValue.MakeUint64(id) }
116-
}
117-
);
118-
119-
Console.WriteLine($"> Series, " +
120-
$"series_id: {(ulong?)row["series_id"]}, " +
121-
$"title: {(string?)row["title"]}, " +
122-
$"release_date: {(DateTime?)row["release_date"]}");
123-
```
124-
12566
## Examples
12667

12768
See **[examples folder](https://github.com/ydb-platform/ydb-dotnet-sdk/tree/main/examples)**

examples/src/EF/EF.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8-
<RootNamespace>EfCore</RootNamespace>
8+
<RootNamespace>EF</RootNamespace>
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="..\..\..\src\EfCore.Ydb\src\EfCore.Ydb.csproj"/>
12+
<ProjectReference Include="..\..\..\src\EFCore.Ydb\src\EntityFrameworkCore.Ydb.csproj"/>
1313
</ItemGroup>
1414
</Project>

examples/src/EF/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using EfCore.Ydb.Extensions;
1+
using EntityFrameworkCore.Ydb.Extensions;
22
using Microsoft.EntityFrameworkCore;
33

44
await using var db = new BloggingContext();
@@ -8,6 +8,7 @@
88

99
Console.WriteLine("Inserting a new blog");
1010
db.Add(new Blog { Url = "http://blogs.msdn.com/adonet" });
11+
1112
await db.SaveChangesAsync();
1213

1314
Console.WriteLine("Querying for a blog");
@@ -30,7 +31,8 @@ internal class BloggingContext : DbContext
3031
public DbSet<Post> Posts { get; set; }
3132

3233
protected override void OnConfiguring(DbContextOptionsBuilder options)
33-
=> options.UseYdb("Host=localhost;Port=2136;Database=/local");
34+
=> options.UseYdb("Host=localhost;Port=2136;Database=/local")
35+
.LogTo(Console.WriteLine);
3436
}
3537

3638
internal class Blog

examples/src/EF_YC/EF_YC.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<ProjectReference Include="..\..\..\src\EfCore.Ydb\src\EfCore.Ydb.csproj"/>
18+
<ProjectReference Include="..\..\..\src\EFCore.Ydb\src\EntityFrameworkCore.Ydb.csproj"/>
1919
<ProjectReference Include="..\..\..\src\Ydb.Sdk\src\Ydb.Sdk.csproj"/>
2020
</ItemGroup>
2121
</Project>

examples/src/EF_YC/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using CommandLine;
22
using EF_YC;
3-
using EfCore.Ydb.Extensions;
3+
using EntityFrameworkCore.Ydb.Extensions;
44
using Microsoft.EntityFrameworkCore;
55
using Microsoft.Extensions.Logging;
66
using Ydb.Sdk.Yc;

0 commit comments

Comments
 (0)