You need to cast ApplicationContext.User to your specific type to get at your custom properties. This is always true when working with .NET principal objects, because they are always stored and manipulated as type IPrincipal (and IIdentity of course), and to get at custom enhancements casting is required.
Personally I tend to create a User class/module with Shared/static methods to abstract the whole thing. Then throughout my code I just do User.Name or User.Supervisor or whatever. The class looks kind of like this:
public static class User
{
public static string Name
{
get { return ApplicationContext.User.Identity.Name; }
}
// etc.
}
I also use a similar approach. However, I have my own class that inherits from BusinessBase, let say MyBusinessBase. I have all of that kind of "global" code into MyBusinessBase. Then I sub-class _ALL_ of my classes from MyBusinessBase, _NOT_ BusinessBase directly.
Copyright (c) Marimer LLC