Closed smross closed 1 year ago
Below is the line that dictates whether the database icon or a gray square shows up in the Model Map. https://github.com/SparkDevNetwork/Rock/blob/43c087ed213659f099b481e774a0131d6c62955d/RockWeb/Blocks/Examples/ModelMap.ascx.cs#L543
Settling for the [NotMapped]
attribute would cause the column to not be mapped to the database, which is not the behavior we want at all.
So, the column exists but it isn't a Foreign Key in the SQL Database. The three connections shown here are CreatedBy/ModifiedByPersonAliasId
and PersonId
to the Person Table.
My best guess is the PersonAlias
class needs to be changed to not use internal get
.
This is documented in Microsoft's documentation for the GetGetMethod()
It's failing on the first boolean condition since GetGetMethod()
is returning null. Since the property is already virtual then it would pass the second condition:
https://github.com/SparkDevNetwork/Rock/blob/43c087ed213659f099b481e774a0131d6c62955d/RockWeb/Blocks/Examples/ModelMap.ascx.cs#L383
@nlBayside, I'm not totally following you. I don't know C# and know enough SQL to do some things (but don't know most things).
The screenshot you displayed does not show a column for AliasPerson. It does show a column for AliasPersonId.
My point is that AliasPerson shows in the model map as a DB column, but doesn't exist in the DB (unless it's some wizardry I don't understand). I've used Rock's 'SQL Map' plugin, Azure Data Studio, and VS Code to examine the DB structure (expanding the 'Tables' tree and then the 'PersonAlias' subtree and then it's columns), and can't find AliasPerson.
@smross, no worries! A lot of that info in my comment is just providing context in case someone from Spark sees the problem here.
You're correct that there isn't a column for AliasPerson in the database. The Model Map block pulls its information from C# class files rather than from the SQL schema. This allows the block to show more information than just what you'd find in the SQL tables. AliasPerson is configured in an odd way in the C# file and appears to only be meant for historical purposes when you merge people.
Please go through all the tasks below
Please provide a brief description of the problem. Please do not forget to attach the relevant screenshots from your side.
The Model Map for Person Alias has the Property AliasPerson listed as a Database column. However, it's not a Database column. It's also not showing as something that can be queried using Lava in our Database(s).
Expected Behavior
The model map should correctly show if properties exist and if they are a database property (or other)
Actual Behavior
The property AliasPerson is listed as a Database Property in the Model Map![Monosnap Model Map JIMROCK Rock RMS 2023-07-19 12-16-15(1)](https://github.com/SparkDevNetwork/Rock/assets/8688424/726e302d-57f2-4d67-94bb-b969baf720e1)
Steps to Reproduce
I checked the DB. Here's what Azure Data Studio lists for my DB's:![image](https://github.com/SparkDevNetwork/Rock/assets/8688424/ceb990e6-9388-48fc-953f-547cbee00116)
I was also unable to query any data from that property via Lava (here's the lava Jim Michael helped me use):
Rock Version
14.2, 15.1
Client Culture Setting
en-US