Skip to content

Commit

Permalink
Simplified some constructors for use with dependency injection
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuck committed Jan 23, 2022
1 parent ce07276 commit a4bf7fc
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Product>YuckQi.Data</Product>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<Description>An implementation of YuckQi.Data for MongoDB databases.</Description>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand Down
6 changes: 4 additions & 2 deletions src/YuckQi.Data.Sql.Dapper.MySql/Handlers/RetrievalHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace YuckQi.Data.Sql.Dapper.MySql.Handlers
{
public class RetrievalHandler<TEntity, TKey, TScope, TRecord> : RetrievalHandlerBase<TEntity, TKey, TScope, TRecord> where TEntity : IEntity<TKey> where TKey : struct where TScope : IDbTransaction
{
public RetrievalHandler(ISqlGenerator<TRecord> sqlGenerator, IMapper mapper) : base(sqlGenerator, DbTypeMap.Default, mapper) { }
public RetrievalHandler(IMapper mapper) : this(mapper, new SqlGenerator<TRecord>()) { }

public RetrievalHandler(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(sqlGenerator, dbTypeMap, mapper) { }
public RetrievalHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator) : this(mapper, sqlGenerator, DbTypeMap.Default) { }

public RetrievalHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper, sqlGenerator, dbTypeMap) { }
}
}
6 changes: 4 additions & 2 deletions src/YuckQi.Data.Sql.Dapper.MySql/Handlers/SearchHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace YuckQi.Data.Sql.Dapper.MySql.Handlers
{
public class SearchHandler<TEntity, TKey, TScope, TRecord> : SearchHandlerBase<TEntity, TKey, TScope, TRecord> where TEntity : IEntity<TKey> where TKey : struct where TScope : IDbTransaction
{
public SearchHandler(ISqlGenerator<TRecord> sqlGenerator, IMapper mapper) : base(sqlGenerator, DbTypeMap.Default, mapper) { }
public SearchHandler(IMapper mapper) : this(mapper, new SqlGenerator<TRecord>()) { }

public SearchHandler(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(sqlGenerator, dbTypeMap, mapper) { }
public SearchHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator) : this(mapper, sqlGenerator, DbTypeMap.Default) { }

public SearchHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper, sqlGenerator, dbTypeMap) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<Description>An implementation of YuckQi.Data for MySQL databases using Dapper and SimpleCRUD.</Description>
<Product>YuckQi.Data</Product>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace YuckQi.Data.Sql.Dapper.Oracle.Handlers
{
public class RetrievalHandler<TEntity, TKey, TScope, TRecord> : RetrievalHandlerBase<TEntity, TKey, TScope, TRecord> where TEntity : IEntity<TKey> where TKey : struct where TScope : IDbTransaction
{
public RetrievalHandler(ISqlGenerator<TRecord> sqlGenerator, IMapper mapper) : base(sqlGenerator, DbTypeMap.Default, mapper) { }
public RetrievalHandler(IMapper mapper) : this(mapper, new SqlGenerator<TRecord>()) { }

public RetrievalHandler(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(sqlGenerator, dbTypeMap, mapper) { }
public RetrievalHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator) : this(mapper, sqlGenerator, DbTypeMap.Default) { }

public RetrievalHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper, sqlGenerator, dbTypeMap) { }
}
}
6 changes: 4 additions & 2 deletions src/YuckQi.Data.Sql.Dapper.Oracle/Handlers/SearchHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace YuckQi.Data.Sql.Dapper.Oracle.Handlers
{
public class SearchHandler<TEntity, TKey, TScope, TRecord> : SearchHandlerBase<TEntity, TKey, TScope, TRecord> where TEntity : IEntity<TKey> where TKey : struct where TScope : IDbTransaction
{
public SearchHandler(ISqlGenerator<TRecord> sqlGenerator, IMapper mapper) : base(sqlGenerator, DbTypeMap.Default, mapper) { }
public SearchHandler(IMapper mapper) : this(mapper, new SqlGenerator<TRecord>()) { }

public SearchHandler(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(sqlGenerator, dbTypeMap, mapper) { }
public SearchHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator) : this(mapper, sqlGenerator, DbTypeMap.Default) { }

public SearchHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper, sqlGenerator, dbTypeMap) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Description>An implementation of YuckQi.Data for Oracle databases using Dapper and SimpleCRUD.</Description>
<Authors>Kevin J Lambert</Authors>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Product>YuckQi.Data</Product>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace YuckQi.Data.Sql.Dapper.SqlServer.Handlers
{
public class RetrievalHandler<TEntity, TKey, TScope, TRecord> : RetrievalHandlerBase<TEntity, TKey, TScope, TRecord> where TEntity : IEntity<TKey> where TKey : struct where TScope : IDbTransaction
{
public RetrievalHandler(ISqlGenerator<TRecord> sqlGenerator, IMapper mapper) : base(sqlGenerator, DbTypeMap.Default, mapper) { }
public RetrievalHandler(IMapper mapper) : this(mapper, new SqlGenerator<TRecord>()) { }

public RetrievalHandler(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(sqlGenerator, dbTypeMap, mapper) { }
public RetrievalHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator) : this(mapper, sqlGenerator, DbTypeMap.Default) { }

public RetrievalHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper, sqlGenerator, dbTypeMap) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ namespace YuckQi.Data.Sql.Dapper.SqlServer.Handlers
{
public class SearchHandler<TEntity, TKey, TScope, TRecord> : SearchHandlerBase<TEntity, TKey, TScope, TRecord> where TEntity : IEntity<TKey> where TKey : struct where TScope : IDbTransaction
{
public SearchHandler(ISqlGenerator<TRecord> sqlGenerator, IMapper mapper) : base(sqlGenerator, DbTypeMap.Default, mapper) { }
public SearchHandler(IMapper mapper) : this(mapper, new SqlGenerator<TRecord>()) { }

public SearchHandler(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(sqlGenerator, dbTypeMap, mapper) { }
public SearchHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator) : this(mapper, sqlGenerator, DbTypeMap.Default) { }

public SearchHandler(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper, sqlGenerator, dbTypeMap) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<Description>An implementation of YuckQi.Data for MSSQL databases using Dapper and SimpleCRUD.</Description>
<Product>YuckQi.Data</Product>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class RetrievalHandlerBase<TEntity, TKey, TScope, TRecord> : RetrievalHan

#region Constructors

protected RetrievalHandlerBase(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(mapper)
protected RetrievalHandlerBase(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper)
{
_sqlGenerator = sqlGenerator ?? throw new ArgumentNullException(nameof(sqlGenerator));
_dbTypeMap = dbTypeMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class SearchHandlerBase<TEntity, TKey, TScope, TRecord> : Search

#region Constructors

protected SearchHandlerBase(ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap, IMapper mapper) : base(mapper)
protected SearchHandlerBase(IMapper mapper, ISqlGenerator<TRecord> sqlGenerator, IReadOnlyDictionary<Type, DbType> dbTypeMap) : base(mapper)
{
_sqlGenerator = sqlGenerator ?? throw new ArgumentNullException(nameof(sqlGenerator));
_dbTypeMap = dbTypeMap;
Expand Down
2 changes: 1 addition & 1 deletion src/YuckQi.Data.Sql.Dapper/YuckQi.Data.Sql.Dapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<Description>An implementation of YuckQi.Data for SQL databases using Dapper and SimpleCRUD.</Description>
<Product>YuckQi.Data</Product>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<Description>An implementation of YuckQi.Data for SQL databases using Entity Framework.</Description>
<Product>YuckQi.Data</Product>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/YuckQi.Data/YuckQi.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Kevin J Lambert</Authors>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<Description>A .NET library of lightweight data access handlers which can be used to compose repositories and domain services.</Description>
<RepositoryUrl>https://github.com/Yuck/YuckQi.Data.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand Down

0 comments on commit a4bf7fc

Please sign in to comment.