I have created a Silverlight app using OpenAccess connecting to my SQL Server DotNetNuke database and using RIA Services.
What I have Now:
I can view the entire DotNetNuke users table in the Silverlight page and sort, group, edit and  update.
Awesome… So far so good.
What I want:
Because DotNetNuke allows adding custom properties which are stored in 2 other tables (1 for Prop definitions and another for values- see attached diagram) I am not sure how I should handle this in ORM.
I can get to Firstname, Last, Email etc (base user fields) but the others like region, Country etc are custom properties defined elsewhere.
From what I have Googled so far I am thinking maybe what I need to do is remap my entities in my Data Model to be able to access all the properties as if they were in a single table- by flattening the entities with Vertical mapping or something….
What I hope to achieve in the end is a way to access the custom props directly by name from the main Users table as if the custom properties were in that table and have the updates work ( as they do with the fields in the Users table now) without writing a ton of code.
I do have this SQL function I created in the past that allows me to access the custom properties by Property name but I am not sure if or how I should use it in the model.
ALTER FUNCTION [dbo].[fnGetUserProfilePropertyValue](    -- Add the parameters for the function here    @PortalId int,    @UserId int,    @PropertyName nvarchar(50))RETURNS nvarchar(3750)ASBEGIN    -- Declare the return variable here    DECLARE @PropertyValue nvarchar(3750)        -- Add the T-SQL statements to compute the return value here    SELECT  @PropertyValue=ISNULL(PropertyValue,'')    FROM [dbo].[UserProfile] aiup    INNER JOIN [dbo].[ProfilePropertyDefinition] aiups ON aiup.PropertyDefinitionID = aiups.PropertyDefinitionID    WHERE aiups.PropertyName = @PropertyName    AND aiup.UserID = @UserId    AND aiups.PortalID = @PortalId    -- Return the result of the function    RETURN @PropertyValueEND
In the past I have accessed the custom props in a query using that function like this:
SELECT      Bla Bla Bla,
dbo.AI_fnGetUserProfilePropertyValue(@Xportalid, AI_UserPortals.UserId, N'Prefix')  AS Prefix,
dbo.AI_fnGetUserProfilePropertyValue(@Xportalid, AI_UserPortals.UserId, N'Street') AS Street,
Etc…
That works great in a query but I am stuck when it comes to moving this to ORM.
Any ideas?
In the past I have accessed the custom props in a query using that function like this:
SELECT      Bla Bla Bla,
dbo.AI_fnGetUserProfilePropertyValue(@Xportalid, AI_UserPortals.UserId, N'Prefix')  AS Prefix,                          dbo.AI_fnGetUserProfilePropertyValue(@Xportalid, AI_UserPortals.UserId, N'Street') AS Street,
Etc…

