Skip to content

Commit 0315784

Browse files
Feat/dynamic query (#5)
* feat: + Attributes for dynamic query SoftStoneDevelop/Gedaq#58 * feat: + Update nuget and change default return type from Enumerable to List; + Add DynamicParametrAttribute #SoftStoneDevelop/Gedaq#58
1 parent aad443c commit 0315784

File tree

10 files changed

+52
-15
lines changed

10 files changed

+52
-15
lines changed

Src/Gedaq.Npgsql/Attributes/BatchPartAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ public sealed class BatchPartAttribute : Attribute
77
{
88
public BatchPartAttribute(
99
string methodName,
10-
int position
11-
)
10+
int position)
1211
{
1312
}
1413
}

Src/Gedaq.Npgsql/Attributes/BinaryExportAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public BinaryExportAttribute(
1717
SourceType sourceType = SourceType.Connection,
1818
AccessModifier accessModifier = AccessModifier.AsContainingClass,
1919
AsyncResult asyncResultType = AsyncResult.ValueTask,
20-
Type asPartInterface = null
21-
)
20+
Type asPartInterface = null)
2221
{
2322
}
2423
}

Src/Gedaq.Npgsql/Attributes/BinaryImportAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public BinaryImportAttribute(
1717
SourceType sourceType = SourceType.Connection,
1818
AccessModifier accessModifier = AccessModifier.AsContainingClass,
1919
AsyncResult asyncResultType = AsyncResult.ValueTask,
20-
Type asPartInterface = null
21-
)
20+
Type asPartInterface = null)
2221
{
2322
}
2423
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using NpgsqlTypes;
2+
using System;
3+
4+
namespace Gedaq.Npgsql.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Class)]
7+
public sealed class ColumnAttribute : Attribute
8+
{
9+
public ColumnAttribute(
10+
string columnName,
11+
string columnAlias,
12+
NpgsqlDbType dbType)
13+
{
14+
}
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace Gedaq.Npgsql.Attributes
4+
{
5+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method, AllowMultiple = true)]
6+
public sealed class DynamicParametrAttribute : Attribute
7+
{
8+
public DynamicParametrAttribute(bool isPositionParametrs = false)
9+
{
10+
}
11+
}
12+
}

Src/Gedaq.Npgsql/Attributes/ParametrAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public ParametrAttribute(
2020
DataRowVersion sourceVersion = DataRowVersion.Current,
2121
byte scale = 0,
2222
byte precision = 0,
23-
string methodParametrName = null
24-
)
23+
string methodParametrName = null)
2524
{
2625
}
2726
}

Src/Gedaq.Npgsql/Attributes/QueryAttribute.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace Gedaq.Npgsql.Attributes
88
public sealed class QueryAttribute : Attribute
99
{
1010
public QueryAttribute(
11-
string query,
1211
string methodName,
12+
string query = null,
1313
Type queryMapType = null,
1414
MethodType methodType = MethodType.Sync,
1515
SourceType sourceType = SourceType.Connection,
@@ -18,8 +18,7 @@ public QueryAttribute(
1818
AccessModifier accessModifier = AccessModifier.AsContainingClass,
1919
AsyncResult asyncResultType = AsyncResult.ValueTask,
2020
Type asPartInterface = null,
21-
ReturnType returnType = ReturnType.Enumerable
22-
)
21+
ReturnType returnType = ReturnType.List)
2322
{
2423
}
2524
}

Src/Gedaq.Npgsql/Attributes/QueryBatchAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public QueryBatchAttribute(
1313
AccessModifier accessModifier = AccessModifier.AsContainingClass,
1414
AsyncResult asyncResultType = AsyncResult.ValueTask,
1515
Type asPartInterface = null,
16-
ReturnType returnType = ReturnType.Enumerable
17-
)
16+
ReturnType returnType = ReturnType.List)
1817
{
1918
}
2019
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace Gedaq.Npgsql.Attributes
4+
{
5+
[AttributeUsage(AttributeTargets.Class)]
6+
public sealed class TableAttribute : Attribute
7+
{
8+
public TableAttribute(
9+
string tableName,
10+
string schemaName,
11+
string tableAlias)
12+
{
13+
}
14+
}
15+
}

Src/Gedaq.Npgsql/Gedaq.Npgsql.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<TargetFramework>net9.0</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageReference Include="Gedaq.Common" Version="0.3.5" />
6+
<PackageReference Include="Gedaq.Common" Version="9.0.0-beta" />
77
<PackageReference Include="Npgsql" Version="10.0.1" />
88
</ItemGroup>
99
<PropertyGroup>
1010
<PackageId>Gedaq.Npgsql</PackageId>
11-
<PackageVersion>9.0.0.2</PackageVersion>
11+
<PackageVersion>9.0.1.1-beta</PackageVersion>
1212
<Authors>Brevnov Vyacheslav Sergeevich</Authors>
1313
<RepositoryUrl>https://github.com/SoftStoneDevelop/Gedaq.Npgsql</RepositoryUrl>
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>

0 commit comments

Comments
 (0)