Skip to content

Commit

Permalink
removed IDataContract Interface dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitM-IN committed Feb 3, 2024
1 parent 03dff52 commit 39c7246
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/QueryGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public QueryGenerator()
/// <param name="schemaName">Optional schema name, default is 'public'.</param>
/// <returns>Select Query in string.</returns>
/// <exception cref="ArgumentException">Thrown when table name or columns are null or empty.</exception>
public string GenerateSelectQuery<T>(string tableName, List<string> listOfColumns, string schemaName) where T : IDataContract
public string GenerateSelectQuery<T>(string tableName, List<string> listOfColumns, string schemaName)
{
if (string.IsNullOrEmpty(tableName) || listOfColumns == null || listOfColumns.Count == 0)
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public string GenerateSelectQuery<T>(string tableName, List<string> listOfColumn
/// <param name="excludedColumns">List of excluded columns.</param>
/// <param name="editedProperties">Dictionary of edited properties.</param>
/// <returns>Update Query in string.</returns>
public string GenerateUpdateQuery<T>(T DataContract, List<string> keyColumns, List<string> excludedColumns, (string propName, object propValue)[] editedProperties) where T : IDataContract
public string GenerateUpdateQuery<T>(T DataContract, List<string> keyColumns, List<string> excludedColumns, (string propName, object propValue)[] editedProperties)
{
string tableName = GetTableName<T>();
string schemaName = GetTableSchema<T>() ?? DEFAULT_SCHEMA_NAME;
Expand All @@ -101,7 +101,7 @@ public string GenerateUpdateQuery<T>(T DataContract, List<string> keyColumns, Li
/// <param name="entity">The entity to be deleted.</param>
/// <param name="keyColumns">List of key columns.</param>
/// <returns>Delete Query in string.</returns>
public string GenerateDeleteQuery<T>(T entity, List<string> keyColumns) where T : IDataContract
public string GenerateDeleteQuery<T>(T entity, List<string> keyColumns)
{
string tableName = GetTableName<T>();
string schemaName = GetTableSchema<T>() ?? DEFAULT_SCHEMA_NAME;
Expand All @@ -123,7 +123,7 @@ public string GenerateDeleteQuery<T>(T entity, List<string> keyColumns) where T
/// <param name="keyColumns">List of key columns.</param>
/// <param name="excludedColumns">List of excluded columns.</param>
/// <returns>Insert Query in string.</returns>
public string GenerateInsertQuery<T>(T entity, List<string> keyColumns, List<string> excludedColumns) where T : IDataContract
public string GenerateInsertQuery<T>(T entity, List<string> keyColumns, List<string> excludedColumns)
{
string tableName = GetTableName<T>();
string schemaName = GetTableSchema<T>() ?? DEFAULT_SCHEMA_NAME;
Expand Down Expand Up @@ -183,11 +183,10 @@ public void Dispose()
/// <summary>
/// Generates a SQL WHERE clause based on the specified entity and key columns.
/// </summary>
/// <typeparam name="T">The type of the entity that implements IDataContract.</typeparam>
/// <param name="entity">The entity for which the condition is generated.</param>
/// <param name="keyColumns">The list of key columns used to create the condition.</param>
/// <returns>A string representing the SQL WHERE clause based on the key columns of the entity.</returns>
public List<string> GetCondition<T>(T entity, List<string> keyColumns) where T : IDataContract
public List<string> GetCondition<T>(T entity, List<string> keyColumns)
{
Type entityType = typeof(T);
PropertyInfo[] keyProperties = GetKeyProperties<T>();
Expand Down

0 comments on commit 39c7246

Please sign in to comment.