I have an MVC4 application and I've been following the Pluralsight video tutorials.
I've got my UserProfile table with an added property and it's working great:
<Table("UserProfile")>
Public Class UserProfile
<Key>
<DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)>
Public Property UserId As Integer
Public Property UserName As String
Public Property FullName As String
End Class
UserId
and UserName
are default, but I've added FullName
and got it working. When I create new users their full name is placed in to the FullName
field in the database.
How do I access FullName
from within a Razor view?
I don't want to use sessions, ViewData or models. In fact I want this displayed on every page so doing this via a controller is not an option.
I was hoping to access it via @Profile.Item("FullName")
or @Profile.PropertyValues("FullName")
but the Profile object is empty. How do I set it?