Skip to content

Commit 7620c05

Browse files
committed
C#: Remove the savechanges origin name from the synthetic name (this is not needed).
1 parent 2a1c0e8 commit 7620c05

File tree

2 files changed

+179
-260
lines changed

2 files changed

+179
-260
lines changed

csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,6 @@ module EntityFramework {
335335
result.getName().matches("SaveChanges%")
336336
}
337337

338-
/**
339-
* Gets the string representation for synthetic identifiers for SaveChanges methods
340-
* on this.
341-
*/
342-
private string getSyntheticNames() {
343-
exists(string qualifier, string type, string name |
344-
this.getASaveChanges().hasQualifiedName(qualifier, type, name)
345-
|
346-
result = getQualifiedName(qualifier, type, name)
347-
)
348-
}
349-
350338
/** Holds if component stack `head :: tail` is required for the input specification. */
351339
predicate requiresComponentStackIn(
352340
Content head, Type headType, SummaryComponentStack tail, int dist
@@ -388,8 +376,7 @@ module EntityFramework {
388376
this = p.getDbContextClass() and
389377
input(this, synthetic, mapped) and
390378
output(this, output, mapped, p) and
391-
result =
392-
getFullSyntheticName(this.getSyntheticNames(), p.getSyntheticName(), synthetic, output)
379+
result = getFullSyntheticName(p.getSyntheticName(), synthetic, output)
393380
)
394381
}
395382
}
@@ -446,13 +433,12 @@ module EntityFramework {
446433
)
447434
}
448435

449-
bindingset[save, prop, stack1, stack2]
436+
bindingset[prop, stack1, stack2]
450437
private string getFullSyntheticName(
451-
string save, string prop, SummaryComponentStack stack1, SummaryComponentStack stack2
438+
string prop, SummaryComponentStack stack1, SummaryComponentStack stack2
452439
) {
453440
result =
454-
save + "#" //
455-
+ prop + "#" //
441+
prop + "#" //
456442
+ SummaryComponentStack::getComponentStack(stack1) + "#" //
457443
+ SummaryComponentStack::getComponentStack(stack2)
458444
}
@@ -478,21 +464,12 @@ module EntityFramework {
478464

479465
DbContextSaveChanges() { this = c.getASaveChanges() }
480466

481-
private string getSyntheticName() {
482-
exists(string qualifier, string type, string name |
483-
this.(Method).hasQualifiedName(qualifier, type, name)
484-
|
485-
result = getQualifiedName(qualifier, type, name)
486-
)
487-
}
488-
489467
pragma[nomagic]
490468
string getOutputSynthetic(SummaryComponentStack input) {
491469
exists(SummaryComponentStack synthetic, Property mapped, DbContextClassSetProperty dbSet |
492470
input(c, input, mapped) and
493471
output(c, synthetic, mapped, dbSet) and
494-
result =
495-
getFullSyntheticName(this.getSyntheticName(), dbSet.getSyntheticName(), input, synthetic)
472+
result = getFullSyntheticName(dbSet.getSyntheticName(), input, synthetic)
496473
)
497474
}
498475

0 commit comments

Comments
 (0)