Skip to content

Commit

Permalink
Merge pull request #478 from TortugaResearch/Chain-4.2
Browse files Browse the repository at this point in the history
Chain 4.2
  • Loading branch information
Grauenwolf authored Jul 7, 2022
2 parents 5a803e5 + a065d90 commit 20383f1
Show file tree
Hide file tree
Showing 3,133 changed files with 245,831 additions and 8,836 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ A Fluent ORM for .NET

* [Documentation Website](https://tortugaresearch.github.io/Tortuga.Chain)
* [API Reference](https://tortugaresearch.github.io/Tortuga.Chain/API/Index.html)
* [Chain Wiki](https://github.com/docevaad/Chain/wiki)
* [Chain vs Dapper](https://github.com/docevaad/Chain/wiki/A-Chain-comparison-to-Dapper)
* [Chain Wiki](https://github.com/TortugaResearch/Tortuga.Chain/wiki)
* [Chain vs Dapper](https://github.com/TortugaResearch/Tortuga.Chain/wiki/A-Chain-comparison-to-Dapper)
* The [change log](Tortuga.Chain/Changelog.md) starts with version 4.0.

## Getting Started
Expand Down
47 changes: 47 additions & 0 deletions Tortuga.Chain/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
## Version 4.2

### Features

[#463 ISupportsDeleteByKeyList should have the same overloads as ISupportsGetByKeyList](https://github.com/TortugaResearch/Chain/issues/463)

[#464 ISupportsDeleteByKey should have the same overloads as ISupportsGetByKey](https://github.com/TortugaResearch/Chain/issues/464)

Allow an object to be used for determining which table to delete from instead of explicitly providing a table name.

[#471 Add Scalar and List options for Char](https://github.com/TortugaResearch/Tortuga.Chain/issues/471)

Adds

* `ToChar(...)`
* `ToCharOrNull(...)`
* `ToCharList(...)`
* `ToCharOrNullList(...)`

[#475 Add ToCharSet and ToByteSet materializers](https://github.com/TortugaResearch/Tortuga.Chain/issues/475)

Adds

* `ToCharSet(...)`
* `ToByteSet(...)`

[#24 Improve column name support for list based materializers](https://github.com/TortugaResearch/Tortuga.Chain/issues/24)

When using ToXxxList/ToXxxSet, you can specify a column name. If multiple columns are returned, which can happen with a stored procedure, it will only read the named column.

## Bug Fixes

[#469 Tortuga.Chain.MappingException: 'Cannot map value of type System.String to property Gender of type Char.' ](https://github.com/TortugaResearch/Tortuga.Chain/issues/469)

Adds mapping between `string` columns and `char` properties. Previously the property had to be a string.

### Technical Debt

[#400 Better Upsert Pattern for SQL Server](https://github.com/TortugaResearch/Tortuga.Chain/issues/400)

Hint `UPDLOCK` and `SERIALIZABLE` when using `MERGE` to perform an upsert. This reduces, though not elimintates, the need to perform an upsert in a transaction.

[#474 Remove duplicate code in list/set based materialzers](https://github.com/TortugaResearch/Tortuga.Chain/issues/474)

Removed roughly 60 lines of code in each column based materializer.


## Version 4.1


Expand Down
4 changes: 2 additions & 2 deletions Tortuga.Chain/DocumentationDocNet/Compiled.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Object/Collection materializers can only populate public properties. It cannot s

Compiled Object/Collection materializers only support public types. Because it does not use reflection, it cannot sidestep the visibility restrictions like the non-compiled versions can.

Compiled Object/Collection materializers do not support generic types (other than Nullable<T>). This is not a design limitation and will be fixed in a later version. https://github.com/docevaad/Chain/issues/64
Compiled Object/Collection materializers do not support generic types (other than Nullable<T>). This is not a design limitation and will be fixed in a later version. https://github.com/TortugaResearch/Tortuga.Chain/issues/64

Compiled Object/Collection materializers do not support nested types. This is not a design limitation and will be fixed in a later version. https://github.com/docevaad/Chain/issues/63
Compiled Object/Collection materializers do not support nested types. This is not a design limitation and will be fixed in a later version. https://github.com/TortugaResearch/Tortuga.Chain/issues/63

Compiled Object/Collection materializers are less tolerant of column/property type mis-matches. For example, if you database column is a `Long`, you can't use a property of type `Nullable<int>`.

Expand Down
2 changes: 1 addition & 1 deletion Tortuga.Chain/DocumentationDocNet/SqlDependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ This appender accepts an `OnChangeEventHandler` delegate, which will be fired on

## Roadmap

Automatic cache invalidation is planned for the future. https://github.com/docevaad/Chain/issues/23
Automatic cache invalidation is planned for the future. https://github.com/TortugaResearch/Tortuga.Chain/issues/23
34 changes: 17 additions & 17 deletions Tortuga.Chain/DocumentationDocNet/docnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"Destination": "..\\..\\docs",
"IncludeSource": "Includes",
"Theme": "Light",
"Footer": "Tortuga Chain. <a href='https://github.com/docevaad/Chain/' target='_blank'>Visit us at GitHub</a>.",
"Footer": "Tortuga Chain. <a href='https://github.com/TortugaResearch/Tortuga.Chain/' target='_blank'>Visit us at GitHub</a>.",
"Pages": {
"__index": "Introduction.md",
"Data Sources": "DataSources.md",
"Command Builders": {
"__index": "CommandBuilders.md",
"From Command Builder": "From.md",
"By Key Command Builder": "ByKey.md",
"Insert Command Builder": "Insert.md",
"Update Command Builder": "Update.md",
"Update Set Command Builder": "UpdateSet.md",
"Upsert Command Builder": "Upsert.md",
"Delete Command Builder": "Delete.md",
"Delete with Filter Command Builder": "DeleteWithFilter.md",
"SQL Command Builder": "SQL.md",
"Table Function Command Builder": "TableFunction.md",
"Scalar Function Command Builder": "ScalarFunction.md",
"Procedure Command Builder": "Procedure.md"
},
"Command Builders": {
"__index": "CommandBuilders.md",
"From Command Builder": "From.md",
"By Key Command Builder": "ByKey.md",
"Insert Command Builder": "Insert.md",
"Update Command Builder": "Update.md",
"Update Set Command Builder": "UpdateSet.md",
"Upsert Command Builder": "Upsert.md",
"Delete Command Builder": "Delete.md",
"Delete with Filter Command Builder": "DeleteWithFilter.md",
"SQL Command Builder": "SQL.md",
"Table Function Command Builder": "TableFunction.md",
"Scalar Function Command Builder": "ScalarFunction.md",
"Procedure Command Builder": "Procedure.md"
},
"Materializers": {
"__index": "Materializers.md",
"Non-Query Materializers": "NonQuery.md",
Expand All @@ -46,4 +46,4 @@
"Entity Framework Integration": "EntityFramework.md",
"NHibernate Integration": "NHibernate.md"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace Traits;


[Trait]
class SupportsDeleteByKeyListTrait<TCommand, TParameter, TObjectName, TDbType> : ISupportsDeleteByKeyList, ISupportsDeleteByKey
where TCommand : DbCommand
Expand All @@ -21,21 +20,33 @@ class SupportsDeleteByKeyListTrait<TCommand, TParameter, TObjectName, TDbType> :

ISingleRowDbCommandBuilder ISupportsDeleteByKey.DeleteByKey(string tableName, string key, DeleteOptions options) => DeleteByKey(DataSource.DatabaseMetadata.ParseObjectName(tableName), key, options);

IMultipleRowDbCommandBuilder ISupportsDeleteByKeyList.DeleteByKeyList<TKey>(string tableName, IEnumerable<TKey> keys, DeleteOptions options) => DeleteByKeyList(DataSource.DatabaseMetadata.ParseObjectName(tableName), keys, options);
ISingleRowDbCommandBuilder<TObject> ISupportsDeleteByKey.DeleteByKey<TObject>(short key, DeleteOptions options)
=> DeleteByKey<TObject>(key, options);

ISingleRowDbCommandBuilder<TObject> ISupportsDeleteByKey.DeleteByKey<TObject>(int key, DeleteOptions options)
=> DeleteByKey<TObject>(key, options);

ISingleRowDbCommandBuilder<TObject> ISupportsDeleteByKey.DeleteByKey<TObject>(long key, DeleteOptions options)
=> DeleteByKey<TObject>(key, options);

ISingleRowDbCommandBuilder<TObject> ISupportsDeleteByKey.DeleteByKey<TObject>(Guid key, DeleteOptions options)
=> DeleteByKey<TObject>(key, options);

ISingleRowDbCommandBuilder<TObject> ISupportsDeleteByKey.DeleteByKey<TObject>(string key, DeleteOptions options)
=> DeleteByKey<TObject>(key, options);

/// <summary>
/// Delete a record by its primary key.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TKey"></typeparam>
/// <param name="tableName">Name of the table.</param>
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
/// <returns>MultipleRowDbCommandBuilder&lt;TCommand, TParameter&gt;.</returns>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<T>(TObjectName tableName, T key, DeleteOptions options = DeleteOptions.None)
where T : struct
=> DataSource.OnDeleteByKeyList(tableName, new List<T> { key }, options);
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TKey>(TObjectName tableName, TKey key, DeleteOptions options = DeleteOptions.None)
where TKey : struct
=> DataSource.OnDeleteByKeyList<TKey>(tableName, new List<TKey> { key }, options);

/// <summary>
/// Delete a record by its primary key.
Expand All @@ -45,7 +56,21 @@ public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<T>(TObjectNam
/// <param name="options">The options.</param>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey(TObjectName tableName, string key, DeleteOptions options = DeleteOptions.None)
=> DataSource.OnDeleteByKeyList(tableName, new List<string> { key }, options);
=> DataSource.OnDeleteByKeyList<string>(tableName, new List<string> { key }, options);

/// <summary>
/// Delete a record by its primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <typeparam name="TKey"></typeparam>
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
/// <returns>MultipleRowDbCommandBuilder&lt;TCommand, TParameter&gt;.</returns>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKey<TObject, TKey>(TKey key, DeleteOptions options = DeleteOptions.None)
where TObject : class
where TKey : struct
=> new SingleRowDbCommandBuilder<TCommand, TParameter, TObject>(DataSource.OnDeleteByKeyList<TKey>(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, new List<TKey> { key }, options));

/// <summary>
/// Delete a record by its primary key.
Expand All @@ -54,9 +79,9 @@ public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey(TObjectName t
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(Guid key, DeleteOptions options = DeleteOptions.None)
public SingleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKey<TObject>(Guid key, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKey(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, key, options);
=> DeleteByKey<TObject, Guid>(key, options);

/// <summary>
/// Delete a record by its primary key.
Expand All @@ -65,9 +90,9 @@ public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(Guid
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(long key, DeleteOptions options = DeleteOptions.None)
public SingleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKey<TObject>(long key, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKey(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, key, options);
=> DeleteByKey<TObject, long>(key, options);

/// <summary>
/// Delete a record by its primary key.
Expand All @@ -76,9 +101,20 @@ public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(long
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(int key, DeleteOptions options = DeleteOptions.None)
public SingleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKey<TObject>(short key, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKey<TObject, short>(key, options);

/// <summary>
/// Delete a record by its primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKey<TObject>(int key, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKey(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, key, options);
=> DeleteByKey<TObject, int>(key, options);

/// <summary>
/// Delete a record by its primary key.
Expand All @@ -87,10 +123,26 @@ public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(int
/// <param name="key">The key.</param>
/// <param name="options">The options.</param>
[Expose]
public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(string key, DeleteOptions options = DeleteOptions.None)
public SingleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKey<TObject>(string key, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKey(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, key, options);
=> new SingleRowDbCommandBuilder<TCommand, TParameter, TObject>(DataSource.OnDeleteByKeyList<string>(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, new List<string> { key }, options));

IMultipleRowDbCommandBuilder<TObject> ISupportsDeleteByKeyList.DeleteByKeyList<TObject, TKey>(IEnumerable<TKey> keys, DeleteOptions options)
=> DeleteByKeyList<TObject, TKey>(keys, options);

IMultipleRowDbCommandBuilder<TObject> ISupportsDeleteByKeyList.DeleteByKeyList<TObject>(IEnumerable<short> keys, DeleteOptions options)
=> DeleteByKeyList<TObject>(keys, options);

IMultipleRowDbCommandBuilder<TObject> ISupportsDeleteByKeyList.DeleteByKeyList<TObject>(IEnumerable<int> keys, DeleteOptions options)
=> DeleteByKeyList<TObject>(keys, options);

IMultipleRowDbCommandBuilder<TObject> ISupportsDeleteByKeyList.DeleteByKeyList<TObject>(IEnumerable<long> keys, DeleteOptions options)
=> DeleteByKeyList<TObject>(keys, options);

IMultipleRowDbCommandBuilder<TObject> ISupportsDeleteByKeyList.DeleteByKeyList<TObject>(IEnumerable<Guid> keys, DeleteOptions options)
=> DeleteByKeyList<TObject>(keys, options);

IMultipleRowDbCommandBuilder ISupportsDeleteByKeyList.DeleteByKeyList<TKey>(string tableName, IEnumerable<TKey> keys, DeleteOptions options) => DeleteByKeyList(DataSource.DatabaseMetadata.ParseObjectName(tableName), keys, options);

/// <summary>
/// Delete multiple rows by key.
Expand All @@ -103,7 +155,73 @@ public SingleRowDbCommandBuilder<TCommand, TParameter> DeleteByKey<TObject>(stri
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter> DeleteByKeyList<TKey>(TObjectName tableName, IEnumerable<TKey> keys, DeleteOptions options = DeleteOptions.None)
=> DataSource.OnDeleteByKeyList(tableName, keys, options);
}

/// <summary>
/// Delete multiple rows by their primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <typeparam name="TKey"></typeparam>
/// <param name="keys">The keys.</param>
/// <param name="options">The options.</param>
/// <returns>MultipleRowDbCommandBuilder&lt;TCommand, TParameter&gt;.</returns>
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKeyList<TObject, TKey>(IEnumerable<TKey> keys, DeleteOptions options = DeleteOptions.None)
where TObject : class
where TKey : struct
=> new MultipleRowDbCommandBuilder<TCommand, TParameter, TObject>(DataSource.OnDeleteByKeyList<TKey>(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, keys, options));

/// <summary>
/// Delete multiple rows by their primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <param name="keys">The keys.</param>
/// <param name="options">The options.</param>
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKeyList<TObject>(IEnumerable<Guid> keys, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKeyList<TObject, Guid>(keys, options);

/// <summary>
/// Delete multiple rows by their primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <param name="keys">The keys.</param>
/// <param name="options">The options.</param>
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKeyList<TObject>(IEnumerable<long> keys, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKeyList<TObject, long>(keys, options);

/// <summary>
/// Delete multiple rows by their primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <param name="keys">The keys.</param>
/// <param name="options">The options.</param>
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKeyList<TObject>(IEnumerable<short> keys, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKeyList<TObject, short>(keys, options);

/// <summary>
/// Delete multiple rows by their primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <param name="keys">The keys.</param>
/// <param name="options">The options.</param>
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKeyList<TObject>(IEnumerable<int> keys, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> DeleteByKeyList<TObject, int>(keys, options);

/// <summary>
/// Delete multiple rows by their primary key.
/// </summary>
/// <typeparam name="TObject">Used to determine the table name</typeparam>
/// <param name="keys">The keys.</param>
/// <param name="options">The options.</param>
[Expose]
public MultipleRowDbCommandBuilder<TCommand, TParameter, TObject> DeleteByKeyList<TObject>(IEnumerable<string> keys, DeleteOptions options = DeleteOptions.None)
where TObject : class
=> new MultipleRowDbCommandBuilder<TCommand, TParameter, TObject>(DataSource.OnDeleteByKeyList<string>(DataSource.DatabaseMetadata.GetTableOrViewFromClass<TObject>().Name, keys, options));
}
4 changes: 2 additions & 2 deletions Tortuga.Chain/Shared/DataSource/OpenDataSourceTrait`5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ConcurrentDictionary<Type, object> ExtensionCache
}

/// <summary>
/// Gets or sets the cache to be used by this data source. The default is .NET's System.Runtime.Caching.MemoryCache.
/// Gets the cache to be used by this data source. The default is .NET's System.Runtime.Caching.MemoryCache.
/// </summary>
[Expose(Inheritance = Inheritance.Override)]
public ICacheAdapter Cache
Expand Down Expand Up @@ -271,4 +271,4 @@ public bool TrySave(string savepointName)

#endif
}
}
}
Loading

0 comments on commit 20383f1

Please sign in to comment.