diff --git a/README.md b/README.md index 71b75a16a..3450b9d22 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Tortuga.Chain/Tortuga.Chain.Access/Tortuga.Chain.Access.csproj b/Tortuga.Chain/Tortuga.Chain.Access/Tortuga.Chain.Access.csproj index 69841a9d8..e7f21d4d8 100644 --- a/Tortuga.Chain/Tortuga.Chain.Access/Tortuga.Chain.Access.csproj +++ b/Tortuga.Chain/Tortuga.Chain.Access/Tortuga.Chain.Access.csproj @@ -16,9 +16,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.CompiledMaterializers/Tortuga.Chain.CompiledMaterializers.csproj b/Tortuga.Chain/Tortuga.Chain.CompiledMaterializers/Tortuga.Chain.CompiledMaterializers.csproj index f253a7127..07bd8e2a4 100644 --- a/Tortuga.Chain/Tortuga.Chain.CompiledMaterializers/Tortuga.Chain.CompiledMaterializers.csproj +++ b/Tortuga.Chain/Tortuga.Chain.CompiledMaterializers/Tortuga.Chain.CompiledMaterializers.csproj @@ -16,9 +16,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.Core.Odbc/Tortuga.Chain.Core.Odbc.csproj b/Tortuga.Chain/Tortuga.Chain.Core.Odbc/Tortuga.Chain.Core.Odbc.csproj index 37d9a4502..63347aba7 100644 --- a/Tortuga.Chain/Tortuga.Chain.Core.Odbc/Tortuga.Chain.Core.Odbc.csproj +++ b/Tortuga.Chain/Tortuga.Chain.Core.Odbc/Tortuga.Chain.Core.Odbc.csproj @@ -17,9 +17,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.Core.OleDb/Tortuga.Chain.Core.OleDb.csproj b/Tortuga.Chain/Tortuga.Chain.Core.OleDb/Tortuga.Chain.Core.OleDb.csproj index 9788da8af..8566d5d99 100644 --- a/Tortuga.Chain/Tortuga.Chain.Core.OleDb/Tortuga.Chain.Core.OleDb.csproj +++ b/Tortuga.Chain/Tortuga.Chain.Core.OleDb/Tortuga.Chain.Core.OleDb.csproj @@ -17,9 +17,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.Core/Tortuga.Chain.Core.csproj b/Tortuga.Chain/Tortuga.Chain.Core/Tortuga.Chain.Core.csproj index 1a844a5fe..9447e635f 100644 --- a/Tortuga.Chain/Tortuga.Chain.Core/Tortuga.Chain.Core.csproj +++ b/Tortuga.Chain/Tortuga.Chain.Core/Tortuga.Chain.Core.csproj @@ -16,9 +16,8 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain - - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.MySql/Tortuga.Chain.MySql.csproj b/Tortuga.Chain/Tortuga.Chain.MySql/Tortuga.Chain.MySql.csproj index 4a489e74d..cfd8e6f96 100644 --- a/Tortuga.Chain/Tortuga.Chain.MySql/Tortuga.Chain.MySql.csproj +++ b/Tortuga.Chain/Tortuga.Chain.MySql/Tortuga.Chain.MySql.csproj @@ -16,9 +16,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertBatch`1.cs b/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertBatch`1.cs index 5d19d8ed6..baa0d1a14 100644 --- a/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertBatch`1.cs +++ b/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertBatch`1.cs @@ -46,7 +46,7 @@ public override CommandExecutionToken Prepare(Ma var identityInsert = m_Options.HasFlag(InsertOptions.IdentityInsert); if (identityInsert) - throw new NotImplementedException("See issue 256. https://github.com/docevaad/Chain/issues/256"); + throw new NotImplementedException("See issue 256. https://github.com/TortugaResearch/Tortuga.Chain/issues/256"); var sqlBuilder = m_Table.CreateSqlBuilder(StrictMode); sqlBuilder.ApplyDesiredColumns(materializer.DesiredColumns()); @@ -105,4 +105,4 @@ public override CommandExecutionToken Prepare(Ma /// public override IReadOnlyList TryGetNonNullableColumns() => m_Table.NonNullableColumns; } -} \ No newline at end of file +} diff --git a/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertObject.cs b/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertObject.cs index 4dcaba234..a301a1a86 100644 --- a/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertObject.cs +++ b/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertObject.cs @@ -38,7 +38,7 @@ public override CommandExecutionToken Prepare(Ma var identityInsert = m_Options.HasFlag(InsertOptions.IdentityInsert); if (identityInsert) - throw new NotImplementedException("See issue 256. https://github.com/docevaad/Chain/issues/256"); + throw new NotImplementedException("See issue 256. https://github.com/TortugaResearch/Tortuga.Chain/issues/256"); var sqlBuilder = Table.CreateSqlBuilder(StrictMode); sqlBuilder.ApplyArgumentValue(DataSource, ArgumentValue, m_Options); diff --git a/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertOrUpdateObject.cs b/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertOrUpdateObject.cs index 81eeb266f..af75c9a3d 100644 --- a/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertOrUpdateObject.cs +++ b/Tortuga.Chain/Tortuga.Chain.PostgreSql/PostgreSql/CommandBuilders/PostgreSqlInsertOrUpdateObject.cs @@ -5,78 +5,78 @@ namespace Tortuga.Chain.PostgreSql.CommandBuilders { - /// - /// Class PostgreSqlInsertOrUpdateObject - /// - internal sealed class PostgreSqlInsertOrUpdateObject : PostgreSqlObjectCommand - where TArgument : class - { - readonly UpsertOptions m_Options; + /// + /// Class PostgreSqlInsertOrUpdateObject + /// + internal sealed class PostgreSqlInsertOrUpdateObject : PostgreSqlObjectCommand + where TArgument : class + { + readonly UpsertOptions m_Options; - /// - /// Initializes a new instance of the class. - /// - /// The data source. - /// Name of the table. - /// The argument value. - /// The options. - public PostgreSqlInsertOrUpdateObject(PostgreSqlDataSourceBase dataSource, PostgreSqlObjectName tableName, TArgument argumentValue, UpsertOptions options) - : base(dataSource, tableName, argumentValue) - { - m_Options = options; - } + /// + /// Initializes a new instance of the class. + /// + /// The data source. + /// Name of the table. + /// The argument value. + /// The options. + public PostgreSqlInsertOrUpdateObject(PostgreSqlDataSourceBase dataSource, PostgreSqlObjectName tableName, TArgument argumentValue, UpsertOptions options) + : base(dataSource, tableName, argumentValue) + { + m_Options = options; + } - /// - /// Prepares the command for execution by generating any necessary SQL. - /// - /// - /// - public override CommandExecutionToken Prepare(Materializer materializer) - { - if (materializer == null) - throw new ArgumentNullException(nameof(materializer), $"{nameof(materializer)} is null."); + /// + /// Prepares the command for execution by generating any necessary SQL. + /// + /// + /// + public override CommandExecutionToken Prepare(Materializer materializer) + { + if (materializer == null) + throw new ArgumentNullException(nameof(materializer), $"{nameof(materializer)} is null."); - var identityInsert = m_Options.HasFlag(UpsertOptions.IdentityInsert); - if (identityInsert) - throw new NotImplementedException("See issue 256. https://github.com/docevaad/Chain/issues/256"); + var identityInsert = m_Options.HasFlag(UpsertOptions.IdentityInsert); + if (identityInsert) + throw new NotImplementedException("See issue 256. https://github.com/TortugaResearch/Tortuga.Chain/issues/256"); - //var primaryKeyNames = Table.PrimaryKeyColumns.Select(x => x.QuotedSqlName); + //var primaryKeyNames = Table.PrimaryKeyColumns.Select(x => x.QuotedSqlName); - var sqlBuilder = Table.CreateSqlBuilder(StrictMode); - sqlBuilder.ApplyArgumentValue(DataSource, ArgumentValue, m_Options); - sqlBuilder.ApplyDesiredColumns(materializer.DesiredColumns()); + var sqlBuilder = Table.CreateSqlBuilder(StrictMode); + sqlBuilder.ApplyArgumentValue(DataSource, ArgumentValue, m_Options); + sqlBuilder.ApplyDesiredColumns(materializer.DesiredColumns()); - if (KeyColumns.Count > 0) - { - sqlBuilder.OverrideKeys(KeyColumns); - } + if (KeyColumns.Count > 0) + { + sqlBuilder.OverrideKeys(KeyColumns); + } - var sql = new StringBuilder(); - List keyParameters; - var isPrimaryKeyIdentity = sqlBuilder.PrimaryKeyIsIdentity(out keyParameters); - if (isPrimaryKeyIdentity && KeyColumns.Count == 0) - { - var areKeysNull = keyParameters.Any(c => c.Value == DBNull.Value || c.Value == null) ? true : false; - if (areKeysNull) - sqlBuilder.BuildInsertStatement(sql, Table.Name.ToString(), null); - else - sqlBuilder.BuildUpdateByKeyStatement(sql, Table.Name.ToString(), null); - sqlBuilder.BuildSelectClause(sql, " RETURNING ", null, ";"); - } - else - { - string conflictNames = string.Join(", ", sqlBuilder.GetKeyColumns().Select(x => x.QuotedSqlName)); + var sql = new StringBuilder(); + List keyParameters; + var isPrimaryKeyIdentity = sqlBuilder.PrimaryKeyIsIdentity(out keyParameters); + if (isPrimaryKeyIdentity && KeyColumns.Count == 0) + { + var areKeysNull = keyParameters.Any(c => c.Value == DBNull.Value || c.Value == null) ? true : false; + if (areKeysNull) + sqlBuilder.BuildInsertStatement(sql, Table.Name.ToString(), null); + else + sqlBuilder.BuildUpdateByKeyStatement(sql, Table.Name.ToString(), null); + sqlBuilder.BuildSelectClause(sql, " RETURNING ", null, ";"); + } + else + { + string conflictNames = string.Join(", ", sqlBuilder.GetKeyColumns().Select(x => x.QuotedSqlName)); - sqlBuilder.BuildInsertClause(sql, $"INSERT INTO {Table.Name.ToString()} (", null, ")"); - sqlBuilder.BuildValuesClause(sql, " VALUES (", ")"); - sqlBuilder.BuildSetClause(sql, $" ON CONFLICT ({conflictNames}) DO UPDATE SET ", null, null); - sqlBuilder.BuildSelectClause(sql, " RETURNING ", null, ";"); - } + sqlBuilder.BuildInsertClause(sql, $"INSERT INTO {Table.Name.ToString()} (", null, ")"); + sqlBuilder.BuildValuesClause(sql, " VALUES (", ")"); + sqlBuilder.BuildSetClause(sql, $" ON CONFLICT ({conflictNames}) DO UPDATE SET ", null, null); + sqlBuilder.BuildSelectClause(sql, " RETURNING ", null, ";"); + } - //Looks like ON CONFLICT is useful here http://www.postgresql.org/docs/current/static/sql-insert.html - //Use RETURNING in place of SQL Servers OUTPUT clause http://www.postgresql.org/docs/current/static/sql-insert.html + //Looks like ON CONFLICT is useful here http://www.postgresql.org/docs/current/static/sql-insert.html + //Use RETURNING in place of SQL Servers OUTPUT clause http://www.postgresql.org/docs/current/static/sql-insert.html - return new PostgreSqlCommandExecutionToken(DataSource, "Insert or update " + Table.Name, sql.ToString(), sqlBuilder.GetParameters()); - } - } -} \ No newline at end of file + return new PostgreSqlCommandExecutionToken(DataSource, "Insert or update " + Table.Name, sql.ToString(), sqlBuilder.GetParameters()); + } + } +} diff --git a/Tortuga.Chain/Tortuga.Chain.PostgreSql/Tortuga.Chain.PostgreSql.csproj b/Tortuga.Chain/Tortuga.Chain.PostgreSql/Tortuga.Chain.PostgreSql.csproj index d13ebc1ba..6686b6f7a 100644 --- a/Tortuga.Chain/Tortuga.Chain.PostgreSql/Tortuga.Chain.PostgreSql.csproj +++ b/Tortuga.Chain/Tortuga.Chain.PostgreSql/Tortuga.Chain.PostgreSql.csproj @@ -16,9 +16,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.SQLite/Tortuga.Chain.SQLite.csproj b/Tortuga.Chain/Tortuga.Chain.SQLite/Tortuga.Chain.SQLite.csproj index 7952eca9c..d766bd1ec 100644 --- a/Tortuga.Chain/Tortuga.Chain.SQLite/Tortuga.Chain.SQLite.csproj +++ b/Tortuga.Chain/Tortuga.Chain.SQLite/Tortuga.Chain.SQLite.csproj @@ -17,9 +17,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.SqlServer.MDS/Tortuga.Chain.SqlServer.MDS.csproj b/Tortuga.Chain/Tortuga.Chain.SqlServer.MDS/Tortuga.Chain.SqlServer.MDS.csproj index 9fb83dd71..7446f24ab 100644 --- a/Tortuga.Chain/Tortuga.Chain.SqlServer.MDS/Tortuga.Chain.SqlServer.MDS.csproj +++ b/Tortuga.Chain/Tortuga.Chain.SqlServer.MDS/Tortuga.Chain.SqlServer.MDS.csproj @@ -16,9 +16,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.SqlServer.OleDb/Tortuga.Chain.SqlServer.OleDb.csproj b/Tortuga.Chain/Tortuga.Chain.SqlServer.OleDb/Tortuga.Chain.SqlServer.OleDb.csproj index 6efb76fc7..1f5a6acef 100644 --- a/Tortuga.Chain/Tortuga.Chain.SqlServer.OleDb/Tortuga.Chain.SqlServer.OleDb.csproj +++ b/Tortuga.Chain/Tortuga.Chain.SqlServer.OleDb/Tortuga.Chain.SqlServer.OleDb.csproj @@ -16,9 +16,9 @@ David Tomcik Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable diff --git a/Tortuga.Chain/Tortuga.Chain.SqlServer/Tortuga.Chain.SqlServer.csproj b/Tortuga.Chain/Tortuga.Chain.SqlServer/Tortuga.Chain.SqlServer.csproj index 6d2e4475c..90a99ea17 100644 --- a/Tortuga.Chain/Tortuga.Chain.SqlServer/Tortuga.Chain.SqlServer.csproj +++ b/Tortuga.Chain/Tortuga.Chain.SqlServer/Tortuga.Chain.SqlServer.csproj @@ -16,9 +16,9 @@ David Tomcik, Jonathan Allen 2016-2019 - https://github.com/docevaad/Chain + https://github.com/TortugaResearch/Tortuga.Chain - https://github.com/docevaad/Chain.git + https://github.com/TortugaResearch/Tortuga.Chain.git git enable