Create and use new ProfileProvider Property in Lightswitch

87 views Asked by At

How can I create and get access to new Properties of ProfileProvider using Lightswitch?

I have tried this: Modified the next section in Web.config/configuration/system.web/

<profile enabled="True" defaultProvider="AspNetProfileProvider">
  <providers>
    <clear />
    <add name="AspNetProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="_IntrinsicData" applicationName="MyApplication" />
  </providers>
  <properties>
    <add name="FullName" />
    <add name="MyCustomProperty" />
  </properties>
</profile>

Then I rebuild the solution and when I try to use it, I can get FullName but not MyCustomProperty:

var a = ServerApplicationContext.CreateContext().Application.User.FullName; // Work
var b = ServerApplicationContext.CreateContext().Application.User.MyCustomProperty; // Don't work

When I go to the definition of ..User.FullName I get to an auto-generated class where there is the Property FullName but there is not MyCustomProperty:

public class ServerUser : ClaimsPrincipal, IUserInternal, IUser, IPrincipal, IIdentity
{
    public AuthenticationType AuthenticationType { get; protected set; }
    public IEnumerable<string> EffectivePermissions { get; }
    public string FullName { get; protected set; }
    public bool IsAnonymous { get; }
    ...
}

I guess rebuilding is not the way the code is auto-generated but don't have a clue of how to achieve this.

Thanks.

0

There are 0 answers