-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Dialect 1 in EFCore.
Before you start using the DBContext you need to set the Dialect to 1 like InterBaseSql.EntityFrameworkCore.InterBase.Storage.Internal.IBSqlGenerationHelper.Dialect = 1; This will tell the SqlGeneratorHelper to not quote identify things.
- Loading branch information
1 parent
eef670d
commit 127427b
Showing
10 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...er/src/InterBaseSql.EntityFrameworkCore.InterBase/Storage/Internal/Changelog.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,19 @@ | |
//$Authors = Jiri Cincura ([email protected]) | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Text; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Diagnostics; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
namespace InterBaseSql.EntityFrameworkCore.InterBase.Storage.Internal; | ||
|
||
public class IBSqlGenerationHelper : RelationalSqlGenerationHelper, IIBSqlGenerationHelper | ||
{ | ||
public static int Dialect = 3; | ||
|
||
public IBSqlGenerationHelper(RelationalSqlGenerationHelperDependencies dependencies) | ||
: base(dependencies) | ||
|
@@ -65,4 +71,48 @@ static void EnsureStringLiteralQueryTypeLength(int length) | |
if (length > IBTypeMappingSource.UnicodeVarcharMaxSize) | ||
throw new ArgumentOutOfRangeException(nameof(length)); | ||
} | ||
|
||
public static string NotEmpty([NotNull] string? value, string parameterName) | ||
{ | ||
if (value is null) | ||
{ | ||
NotEmpty(parameterName, nameof(parameterName)); | ||
|
||
throw new ArgumentNullException(parameterName); | ||
} | ||
|
||
if (value.Trim().Length == 0) | ||
{ | ||
NotEmpty(parameterName, nameof(parameterName)); | ||
|
||
throw new ArgumentException(AbstractionsStrings.ArgumentIsEmpty(parameterName)); | ||
} | ||
|
||
return value; | ||
} | ||
public override string DelimitIdentifier(string identifier) | ||
{ | ||
if (Dialect == 3) | ||
return $"\"{EscapeIdentifier(NotEmpty(identifier, nameof(identifier)))}\""; | ||
else | ||
return $"{EscapeIdentifier(NotEmpty(identifier, nameof(identifier)))}"; | ||
} | ||
|
||
public override void DelimitIdentifier(StringBuilder builder, string identifier) | ||
{ | ||
NotEmpty(identifier, nameof(identifier)); | ||
|
||
if (Dialect == 3) | ||
{ | ||
builder.Append('"'); | ||
EscapeIdentifier(builder, identifier); | ||
builder.Append('"'); | ||
} | ||
else | ||
EscapeIdentifier(builder, identifier); | ||
} | ||
|
||
public override string DelimitIdentifier(string name, string? schema) | ||
=> DelimitIdentifier(NotEmpty(name, nameof(name))); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters