Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Elanis committed Dec 16, 2019
2 parents 5db9fae + 9c8d067 commit a0cf185
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
42 changes: 21 additions & 21 deletions Dysnomia.Common.SQL/DbReaderMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class DbReaderMapper {
/**
* String from reader
*/
public static string GetString(IDataReader reader, string key, bool catchNull = true, string defaultValue = "") {
public static string GetString(this IDataReader reader, string key, bool catchNull = true, string defaultValue = "") {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -42,7 +42,7 @@ public static string GetString(IDataReader reader, string key, bool catchNull =
/**
* Short/Int16 from reader
*/
public static short GetInt16(IDataReader reader, string key, bool catchNull = true, short defaultValue = 0) {
public static short GetInt16(this IDataReader reader, string key, bool catchNull = true, short defaultValue = 0) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -51,14 +51,14 @@ public static short GetInt16(IDataReader reader, string key, bool catchNull = tr

return defaultValue;
}
public static short GetShort(IDataReader reader, string key, bool catchNull = true, short defaultValue = 0) {
public static short GetShort(this IDataReader reader, string key, bool catchNull = true, short defaultValue = 0) {
return GetInt16(reader, key, catchNull, defaultValue);
}

/**
* Nullable Short/Int16 from reader
*/
public static short? GetNullableInt16(IDataReader reader, string key) {
public static short? GetNullableInt16(this IDataReader reader, string key) {
var id = reader.GetOrdinal(key);

if(!reader.IsDBNull(id)) {
Expand All @@ -67,14 +67,14 @@ public static short GetShort(IDataReader reader, string key, bool catchNull = tr

return null;
}
public static short? GetNullableShort(IDataReader reader, string key) {
public static short? GetNullableShort(this IDataReader reader, string key) {
return GetShort(reader, key);
}

/**
* Int/Int32 from reader
*/
public static int GetInt32(IDataReader reader, string key, bool catchNull = true, int defaultValue = 0) {
public static int GetInt32(this IDataReader reader, string key, bool catchNull = true, int defaultValue = 0) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -83,14 +83,14 @@ public static int GetInt32(IDataReader reader, string key, bool catchNull = true

return defaultValue;
}
public static int GetInt(IDataReader reader, string key, bool catchNull = true, short defaultValue = 0) {
public static int GetInt(this IDataReader reader, string key, bool catchNull = true, short defaultValue = 0) {
return GetInt32(reader, key, catchNull, defaultValue);
}

/**
* Nullable Int/Int32 from reader
*/
public static int? GetNullableInt32(IDataReader reader, string key) {
public static int? GetNullableInt32(this IDataReader reader, string key) {
var id = reader.GetOrdinal(key);

if(!reader.IsDBNull(id)) {
Expand All @@ -99,14 +99,14 @@ public static int GetInt(IDataReader reader, string key, bool catchNull = true,

return null;
}
public static int? GetNullableInt(IDataReader reader, string key) {
public static int? GetNullableInt(this IDataReader reader, string key) {
return GetNullableInt32(reader, key);
}

/**
* Int/Int32 from reader
*/
public static long GetInt64(IDataReader reader, string key, bool catchNull = true, long defaultValue = 0) {
public static long GetInt64(this IDataReader reader, string key, bool catchNull = true, long defaultValue = 0) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -115,14 +115,14 @@ public static long GetInt64(IDataReader reader, string key, bool catchNull = tru

return defaultValue;
}
public static long GetLong(IDataReader reader, string key, bool catchNull = true, long defaultValue = 0) {
public static long GetLong(this IDataReader reader, string key, bool catchNull = true, long defaultValue = 0) {
return GetInt64(reader, key, catchNull, defaultValue);
}

/**
* Nullable Int/Int32 from reader
*/
public static long? GetNullableInt64(IDataReader reader, string key) {
public static long? GetNullableInt64(this IDataReader reader, string key) {
var id = reader.GetOrdinal(key);

if(!reader.IsDBNull(id)) {
Expand All @@ -131,14 +131,14 @@ public static long GetLong(IDataReader reader, string key, bool catchNull = true

return null;
}
public static long? GetNullableLong(IDataReader reader, string key) {
public static long? GetNullableLong(this IDataReader reader, string key) {
return GetNullableInt64(reader, key);
}

/**
* Decimal from reader
*/
public static decimal GetDecimal(IDataReader reader, string key, bool catchNull = true, decimal defaultValue = 0) {
public static decimal GetDecimal(this IDataReader reader, string key, bool catchNull = true, decimal defaultValue = 0) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -151,7 +151,7 @@ public static decimal GetDecimal(IDataReader reader, string key, bool catchNull
/**
* Nullable Decimal from reader
*/
public static decimal? GetNullableDecimal(IDataReader reader, string key) {
public static decimal? GetNullableDecimal(this IDataReader reader, string key) {
var id = reader.GetOrdinal(key);

if(!reader.IsDBNull(id)) {
Expand All @@ -164,7 +164,7 @@ public static decimal GetDecimal(IDataReader reader, string key, bool catchNull
/**
* Boolean from reader
*/
public static bool GetBoolean(IDataReader reader, string key, bool catchNull = true, bool defaultValue = false) {
public static bool GetBoolean(this IDataReader reader, string key, bool catchNull = true, bool defaultValue = false) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -177,7 +177,7 @@ public static bool GetBoolean(IDataReader reader, string key, bool catchNull = t
/**
* DateTime from reader
*/
public static DateTime GetDateTime(IDataReader reader, string key, bool catchNull = true, DateTime defaultValue = new DateTime()) {
public static DateTime GetDateTime(this IDataReader reader, string key, bool catchNull = true, DateTime defaultValue = new DateTime()) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -190,7 +190,7 @@ public static bool GetBoolean(IDataReader reader, string key, bool catchNull = t
/**
* Nullable DateTime from reader
*/
public static DateTime? GetNullableDateTime(IDataReader reader, string key) {
public static DateTime? GetNullableDateTime(this IDataReader reader, string key) {
var id = reader.GetOrdinal(key);

if(!reader.IsDBNull(id)) {
Expand All @@ -203,7 +203,7 @@ public static bool GetBoolean(IDataReader reader, string key, bool catchNull = t
/**
* Guid
*/
public static Guid GetGuid(IDataReader reader, string key, bool catchNull, Guid defaultValue) {
public static Guid GetGuid(this IDataReader reader, string key, bool catchNull, Guid defaultValue) {
var id = reader.GetOrdinal(key);

if(!catchNull || !reader.IsDBNull(id)) {
Expand All @@ -212,10 +212,10 @@ public static Guid GetGuid(IDataReader reader, string key, bool catchNull, Guid

return defaultValue;
}
public static Guid GetGuid(IDataReader reader, string key, bool catchNull, string guidData) {
public static Guid GetGuid(this IDataReader reader, string key, bool catchNull, string guidData) {
return GetGuid(reader, key, catchNull, Guid.Parse(guidData));
}
public static Guid GetGuid(IDataReader reader, string key, bool catchNull = true) {
public static Guid GetGuid(this IDataReader reader, string key, bool catchNull = true) {
return GetGuid(reader, key, catchNull, Guid.Empty);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Dysnomia.Common.SQL/Dysnomia.Common.SQL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<PackageProjectUrl>https://github.com/Dysnomia-Studio/Dysnomia.Common.SQL</PackageProjectUrl>
<RepositoryUrl>https://github.com/Dysnomia-Studio/Dysnomia.Common.SQL</RepositoryUrl>
<RepositoryType>Github</RepositoryType>
<PackageReleaseNotes>Added DbReaderMapper.GetDecimal()</PackageReleaseNotes>
<Version>1.0.4</Version>
<AssemblyVersion>1.0.4.0</AssemblyVersion>
<FileVersion>1.0.4.0</FileVersion>
<PackageReleaseNotes>Using extension methods instead of parameters</PackageReleaseNotes>
<Version>1.1.0-rc1</Version>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit a0cf185

Please sign in to comment.