Skip to main content
All docs
V23.2
.NET 6.0+

ISecurityUserLoginInfo.ProviderUserKey Property

Returns a user’s ID according to the current provider.

Namespace: DevExpress.ExpressApp.Security

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

string ProviderUserKey { get; }

Property Value

Type Description
String

The user name.

Remarks

For Windows Active Directory or Google, the ProviderUserKey property value is a Windows user name or a Google account ID, respectively. This value is unique for a specific provider, but different providers can have matching keys.

The LoginProviderName and ProviderUserKey form a unique combination. The ProviderUserKey is not necessarily unique among all providers but is always unique for a specific provider.

To support this unique combination, XAF does the following:

  • Applies the Indexed attribute in XPO-based applications.
  • Specifies that ISecurityUserLoginInfo.LoginProviderName and ISecurityUserLoginInfo.ProviderUserKey pairs should be unique in any override of the MySolutionDbContext.OnModelCreating method:

    using DevExpress.ExpressApp.Security;
    // ... 
    public class MySolutionDbContext : DbContext {
        //...
        public DbSet<ApplicationUser> Users { get; set; }
        public DbSet<ApplicationUserLoginInfo> UserLoginInfos { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder) {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<ApplicationUserLoginInfo>(b => {
                b.HasIndex(nameof(ISecurityUserLoginInfo.LoginProviderName), 
                    nameof(ISecurityUserLoginInfo.ProviderUserKey)).IsUnique();
            });
        }
    }
    
See Also