Skip to content

Commit 74922cc

Browse files
next patch
1 parent 5344003 commit 74922cc

File tree

9 files changed

+17
-16
lines changed

9 files changed

+17
-16
lines changed

src/EFCore.Ydb/src/Extensions/YdbServiceCollectionExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using Microsoft.EntityFrameworkCore.Query;
1717
using Microsoft.EntityFrameworkCore.Storage;
1818
using Microsoft.EntityFrameworkCore.Update;
19-
using Microsoft.EntityFrameworkCore.ValueGeneration;
2019
using Microsoft.Extensions.DependencyInjection;
2120

2221
namespace EntityFrameworkCore.Ydb.Extensions;

src/EFCore.Ydb/src/Query/Internal/YdbMethodCallTranslatorProvider.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using EntityFrameworkCore.Ydb.Query.Internal.Translators;
2-
using EntityFrameworkCore.Ydb.Storage.Internal;
32
using Microsoft.EntityFrameworkCore.Query;
43

54
namespace EntityFrameworkCore.Ydb.Query.Internal;
@@ -15,7 +14,6 @@ public YdbMethodCallTranslatorProvider(RelationalMethodCallTranslatorProviderDep
1514
[
1615
new YdbDateTimeMethodTranslator(sqlExpressionFactory),
1716
new YdbMathTranslator(sqlExpressionFactory),
18-
new YdbMathTranslator(sqlExpressionFactory),
1917
new YdbByteArrayMethodTranslator(sqlExpressionFactory),
2018
]
2119
);

src/EFCore.Ydb/src/Query/Internal/YdbQueryableMethodTranslatingExpressionVisitor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Linq.Expressions;
21
using EntityFrameworkCore.Ydb.Storage.Internal;
32
using Microsoft.EntityFrameworkCore.Query;
43

src/EFCore.Ydb/src/Query/Internal/YdbSqlAliasManager.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Diagnostics.CodeAnalysis;
3-
using System.Linq;
43
using System.Linq.Expressions;
54
using Microsoft.EntityFrameworkCore.Query;
65
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
@@ -77,10 +76,7 @@ private Expression VisitLeftJoin(LeftJoinExpression leftJoinExpression)
7776
leftJoinExpression.JoinPredicate
7877
);
7978

80-
private Expression VisitTable(TableExpressionBase tableExpression)
81-
{
82-
return tableExpression;
83-
}
79+
private static Expression VisitTable(TableExpressionBase tableExpression) => tableExpression;
8480

8581
private IReadOnlyList<ProjectionExpression> AdjustAliases(
8682
IReadOnlyList<ProjectionExpression> projections,

src/EFCore.Ydb/src/Storage/Internal/Mapping/YdbDecimalTypeMapping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p
2727

2828
protected override string ProcessStoreType(
2929
RelationalTypeMappingParameters parameters, string storeType, string storeTypeNameBase
30-
) => $"Decimal({parameters.Precision ?? DefaultPrecision}, {parameters.Scale ?? DefaultScale})";
30+
) => $"{storeType}({parameters.Precision ?? DefaultPrecision}, {parameters.Scale ?? DefaultScale})";
3131
}

src/Ydb.Sdk/src/Ado/YdbCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBeha
213213
var ydbDataReader = await YdbDataReader.CreateYdbDataReader(
214214
await YdbConnection.Session.ExecuteQuery(
215215
preparedSql.ToString(), ydbParameters, execSettings, transaction?.TransactionControl
216-
),
217-
YdbConnection.Session.OnStatus, transaction
216+
), YdbConnection.OnStatus, transaction
218217
);
219218

220219
YdbConnection.LastReader = ydbDataReader;

src/Ydb.Sdk/src/Ado/YdbConnection.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ public override string ConnectionString
160160

161161
private ConnectionState ConnectionState { get; set; } = ConnectionState.Closed; // Invoke AsyncOpen()
162162

163+
internal void OnStatus(Status status)
164+
{
165+
_session.OnStatus(status);
166+
167+
if (!_session.IsActive)
168+
{
169+
ConnectionState = ConnectionState.Broken;
170+
}
171+
}
172+
163173
internal YdbDataReader? LastReader { get; set; }
164174
internal string LastCommand { get; set; } = string.Empty;
165175
internal bool IsBusy => LastReader is { IsOpen: true };

src/Ydb.Sdk/src/Ado/YdbSchema.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ internal static async Task<YdbTable> DescribeTable(
6565

6666
if (status.IsNotSuccess)
6767
{
68-
ydbConnection.Session.OnStatus(status);
68+
ydbConnection.OnStatus(status);
6969

7070
throw new YdbException(status);
7171
}
@@ -76,7 +76,7 @@ internal static async Task<YdbTable> DescribeTable(
7676
}
7777
catch (Driver.TransportException e)
7878
{
79-
ydbConnection.Session.OnStatus(e.Status);
79+
ydbConnection.OnStatus(e.Status);
8080

8181
throw new YdbException("Transport error on DescribeTable", e);
8282
}

src/Ydb.Sdk/src/Ado/YdbTransaction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private async Task FinishTransaction(Func<string, Task<Status>> finishMethod)
9999
{
100100
Failed = true;
101101

102-
DbConnection.Session.OnStatus(status);
102+
DbConnection.OnStatus(status);
103103

104104
throw new YdbException(status);
105105
}
@@ -108,7 +108,7 @@ private async Task FinishTransaction(Func<string, Task<Status>> finishMethod)
108108
{
109109
Failed = true;
110110

111-
DbConnection.Session.OnStatus(e.Status);
111+
DbConnection.OnStatus(e.Status);
112112

113113
throw new YdbException(e.Status);
114114
}

0 commit comments

Comments
 (0)