Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,15 @@ public override bool Create(
&& relationalTypeMapping.Scale != defaultInstance.Scale;
var dbTypeDifferent = relationalTypeMapping.DbType != null
&& relationalTypeMapping.DbType != defaultInstance.DbType;
if (storeTypeDifferent || sizeDifferent || precisionDifferent || scaleDifferent || dbTypeDifferent)
var isUnicodeDifferent = relationalTypeMapping.IsUnicode != defaultInstance.IsUnicode;
var isFixedLengthDifferent = relationalTypeMapping.IsFixedLength != defaultInstance.IsFixedLength;
if (storeTypeDifferent
|| sizeDifferent
|| precisionDifferent
|| scaleDifferent
|| dbTypeDifferent
|| isUnicodeDifferent
|| isFixedLengthDifferent)
{
AddNamespace(typeof(RelationalTypeMappingInfo), parameters.Namespaces);
mainBuilder.AppendLine(",")
Expand All @@ -2169,6 +2177,18 @@ public override bool Create(
"size", code.Literal(relationalTypeMapping.Size), mainBuilder, ref firstParameter);
}

if (isUnicodeDifferent)
{
GenerateArgument(
"unicode", code.Literal(relationalTypeMapping.IsUnicode), mainBuilder, ref firstParameter);
}

if (isFixedLengthDifferent)
{
GenerateArgument(
"fixedLength", code.Literal(relationalTypeMapping.IsFixedLength), mainBuilder, ref firstParameter);
}

if (precisionDifferent)
{
GenerateArgument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ public SqlServerStringTypeMapping(
private static string GetDefaultStoreName(bool unicode, bool fixedLength)
=> unicode
? fixedLength ? "nchar" : "nvarchar"
: fixedLength
? "char"
: "varchar";
: fixedLength ? "char" : "varchar";

private static DbType? GetDbType(bool unicode, bool fixedLength)
=> unicode
Expand Down
Loading