Commit 384f730
committed
Throw exception on
The `ContentType` is no longer stored as an attribute, so models attempting to `[FilterByAttribute("ContentType", …)]` will never return results—or, perhaps worse, operate off of potentially stale results from prior to the migration, yielding inconsistent results. To help avoid this situation, this will throw a runtime exception when a user attempts to map a model with this setting.
A code analyzer would be a more sophisticated approach, since this is fundamentally a design-time problem. This is a quick and easy alternative that should prevent this scenario from being introduced, while giving clear guidance to implementations that have already implemented this from previous versions.[FilterByAttribute("ContentType", …)]
1 parent 13b1114 commit 384f730
1 file changed
Lines changed: 16 additions & 0 deletions
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
34 | 49 | | |
35 | 50 | | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| |||
0 commit comments