Skip to content

Allow underscores in identifiers again #29821

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Dec 12, 2022
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
5 changes: 3 additions & 2 deletions src/EFCore.Design/Design/Internal/CSharpHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1510,10 +1510,11 @@ private static bool IsIdentifierPartCharacter(char ch)
{
if (ch < 'a')
{
return ch < 'A'
return (ch < 'A'
? ch >= '0'
&& ch <= '9'
: ch <= 'Z';
: ch <= 'Z')
|| ch == '_';
}

if (ch <= 'z')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2520,12 +2520,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba
afterSaveBehavior: PropertySaveBehavior.Throw);

var overrides = new StoreObjectDictionary<RuntimeRelationalPropertyOverrides>();
var idDerivedInsert = new RuntimeRelationalPropertyOverrides(
var idDerived_Insert = new RuntimeRelationalPropertyOverrides(
id,
StoreObjectIdentifier.InsertStoredProcedure(""Derived_Insert"", ""TPC""),
true,
""DerivedId"");
overrides.Add(StoreObjectIdentifier.InsertStoredProcedure(""Derived_Insert"", ""TPC""), idDerivedInsert);
overrides.Add(StoreObjectIdentifier.InsertStoredProcedure(""Derived_Insert"", ""TPC""), idDerived_Insert);
var idPrincipalBaseView = new RuntimeRelationalPropertyOverrides(
id,
StoreObjectIdentifier.View(""PrincipalBaseView"", ""TPC""),
Expand Down Expand Up @@ -4579,23 +4579,23 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas
nullable: true);
blob.AddAnnotation(""Cosmos:PropertyName"", ""JsonBlob"");

var id0 = runtimeEntityType.AddProperty(
var __id = runtimeEntityType.AddProperty(
""__id"",
typeof(string),
afterSaveBehavior: PropertySaveBehavior.Throw,
valueGeneratorFactory: new IdValueGeneratorFactory().Create);
id0.AddAnnotation(""Cosmos:PropertyName"", ""id"");
__id.AddAnnotation(""Cosmos:PropertyName"", ""id"");

var jObject = runtimeEntityType.AddProperty(
var __jObject = runtimeEntityType.AddProperty(
""__jObject"",
typeof(JObject),
nullable: true,
valueGenerated: ValueGenerated.OnAddOrUpdate,
beforeSaveBehavior: PropertySaveBehavior.Ignore,
afterSaveBehavior: PropertySaveBehavior.Ignore);
jObject.AddAnnotation(""Cosmos:PropertyName"", """");
__jObject.AddAnnotation(""Cosmos:PropertyName"", """");

var etag = runtimeEntityType.AddProperty(
var _etag = runtimeEntityType.AddProperty(
""_etag"",
typeof(string),
nullable: true,
Expand All @@ -4609,7 +4609,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas
runtimeEntityType.SetPrimaryKey(key);

var key0 = runtimeEntityType.AddKey(
new[] { id0, partitionId });
new[] { __id, partitionId });

return runtimeEntityType;
}
Expand Down