-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#857 - Added the necessary attributes for the MDS.
- Loading branch information
1 parent
b6e77a7
commit edafa5a
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
RepoDb.SqlServer/RepoDb.SqlServer/Attributes/SqlParameterOffsetAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Data.SqlClient; | ||
|
||
namespace RepoDb.Attributes | ||
{ | ||
/// <summary> | ||
/// An attribute used to define a value to the <see cref="SqlParameter.Offset"/> property via an entity property | ||
/// before the actual execution. | ||
/// </summary> | ||
public class SqlParameterOffsetAttribute : ParameterPropertyValueSetterAttribute | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="SqlParameterOffsetAttribute"/> class. | ||
/// </summary> | ||
/// <param name="offset">The offset value.</param> | ||
public SqlParameterOffsetAttribute(int offset) | ||
: base(typeof(SqlParameter), nameof(SqlParameter.Offset), offset) | ||
{ } | ||
|
||
/// <summary> | ||
/// Gets a type name that is currently mapped. | ||
/// </summary> | ||
public int Offset => (int)Value; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
RepoDb.SqlServer/RepoDb.SqlServer/Attributes/SqlParameterSqlDbTypeAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.Data.SqlClient; | ||
using System.Data; | ||
|
||
namespace RepoDb.Attributes | ||
{ | ||
/// <summary> | ||
/// An attribute used to define a value to the <see cref="SqlParameter.SqlDbType"/> property via an entity property | ||
/// before the actual execution. | ||
/// </summary> | ||
public class SqlParameterSqlDbTypeAttribute : ParameterPropertyValueSetterAttribute | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="SqlParameterSqlDbTypeAttribute"/> class. | ||
/// </summary> | ||
/// <param name="sqlDbType">The value of the target <see cref="System.Data.SqlDbType"/>.</param> | ||
public SqlParameterSqlDbTypeAttribute(SqlDbType sqlDbType) | ||
: base(typeof(SqlParameter), nameof(SqlParameter.SqlDbType), sqlDbType) | ||
{ } | ||
|
||
/// <summary> | ||
/// Gets a <see cref="System.Data.SqlDbType"/> that is currently mapped. | ||
/// </summary> | ||
public SqlDbType SqlDbType => (SqlDbType)Value; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
RepoDb.SqlServer/RepoDb.SqlServer/Attributes/SqlParameterTypeNameAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Data.SqlClient; | ||
|
||
namespace RepoDb.Attributes | ||
{ | ||
/// <summary> | ||
/// An attribute used to define a value to the <see cref="SqlParameter.TypeName"/> property via an entity property | ||
/// before the actual execution. | ||
/// </summary> | ||
public class SqlParameterTypeNameAttribute : ParameterPropertyValueSetterAttribute | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="SqlParameterTypeNameAttribute"/> class. | ||
/// </summary> | ||
/// <param name="typeName">The name of the type.</param> | ||
public SqlParameterTypeNameAttribute(string typeName) | ||
: base(typeof(SqlParameter), nameof(SqlParameter.TypeName), typeName) | ||
{ } | ||
|
||
/// <summary> | ||
/// Gets a type name that is currently mapped. | ||
/// </summary> | ||
public string TypeName => (string)Value; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
RepoDb.SqlServer/RepoDb.SqlServer/Attributes/SqlParameterUdtTypeNameAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Data.SqlClient; | ||
|
||
namespace RepoDb.Attributes | ||
{ | ||
/// <summary> | ||
/// An attribute used to define a value to the <see cref="SqlParameter.UdtTypeName"/> property via an entity property | ||
/// before the actual execution. | ||
/// </summary> | ||
public class SqlParameterUdtTypeNameAttribute : ParameterPropertyValueSetterAttribute | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="SqlParameterTypeNameAttribute"/> class. | ||
/// </summary> | ||
/// <param name="udtTypeName">The name of the UTD.</param> | ||
public SqlParameterUdtTypeNameAttribute(string udtTypeName) | ||
: base(typeof(SqlParameter), nameof(SqlParameter.UdtTypeName), udtTypeName) | ||
{ } | ||
|
||
/// <summary> | ||
/// Gets a type name that is currently mapped. | ||
/// </summary> | ||
public string UdtTypeName => (string)Value; | ||
} | ||
} |