Search code examples
ormorchardcmsdatacontext

Orchard's Context data - so close yet so far


Stepping thru the object hierarchy while debugging - starting from the WorkContext.CurrentUser viewed from debugger's Locals - all these properties have correctly populated values and I can access the values of 2 circled properties with:

WorkContext.CurrentUser.Email
WorkContext.CurrentUser.UserName

I'd like to understand the syntax that lets me access the value in 'InstitutionId' enter image description here

Thanks


Solution

  • It seems like you altered the core UserPartRecord class (added InstitutionId property), but haven't altered the UserPart to expose it. UserPart is a wrapper around that record that exposes record properties.

    You can always access the underlying record data directly like this: WorkContext.CurrentUser.As<UserPart>().Record.InstitutionId