コード例 #1
0
 public static void BuildIdentityUserClaim <TKey>(this EntityMappingBuilder <IIdentityUserClaim <TKey> > builder, string tableName = UserClaimTableName)
     where TKey : IEquatable <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(uc => uc.Id);
     builder.Association(x => x.User, k => k.UserId, other => other.Id, false);
 }
コード例 #2
0
 public static void BuildIdentityRoleClaim <TKey>(this EntityMappingBuilder <IIdentityRoleClaim <TKey> > builder, string tableName = RoleClaimTableName)
     where TKey : IEquatable <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(rc => rc.Id);
     builder.Association(x => x.Role, k => k.RoleId, other => other.Id, true);
 }
コード例 #3
0
 public static void BuildIdentityUserRole <TKey>(this EntityMappingBuilder <IIdentityUserRole <TKey> > builder, string tableName = UserRoleTableName)
     where TKey : IEquatable <TKey>
 {
     builder.HasTableName(tableName);
     builder.HasPrimaryKey(r => new { r.UserId, r.RoleId });
     builder.Association(x => x.User, k => k.UserId, other => other.Id, false);
 }
コード例 #4
0
        public static void BuildIdentityUserLogin <TKey>(this EntityMappingBuilder <IIdentityUserLogin <TKey> > builder, StoreOptions storeOptions, string tableName = UserLoginTableName)
            where TKey : IEquatable <TKey>
        {
            builder.HasTableName(tableName);
            builder.HasPrimaryKey(l => new { l.LoginProvider, l.ProviderKey });
            var maxKeyLength = storeOptions?.MaxLengthForKeys ?? 0;

            if (maxKeyLength > 0)
            {
                builder.Property(l => l.LoginProvider).HasLength(maxKeyLength);
                builder.Property(l => l.ProviderKey).HasLength(maxKeyLength);
            }
            builder.Association(x => x.User, k => k.UserId, other => other.Id, false);
        }
コード例 #5
0
 public static void BuildIdentityUserWithTokens <TEntity, TKey>(this EntityMappingBuilder <TEntity> builder)
     where TKey : IEquatable <TKey>
     where TEntity : class, IIdentityUserWithTokens <TKey> => builder.Association(x => x.UserTokens, k => k.Id, other => other.UserId, false);
コード例 #6
0
        //public static void BuildIdentityRoleWithConcurrency<TEntity, TKey>(this EntityMappingBuilder<TEntity> builder)
        //  where TKey : IEquatable<TKey>
        //  where TEntity : class, IIdentityRoleWithConcurrency<TKey> => builder.Property(r => r.ConcurrencyStamp).IsConcurrencyToken();

        public static void BuildIdentityRoleWithUsers <TEntity, TKey>(this EntityMappingBuilder <TEntity> builder)
            where TKey : IEquatable <TKey>
            where TEntity : class, IIdentityRoleWithUsers <TKey> => builder.Association(x => x.UserRoles, k => k.Id, ur => ur.RoleId, false);
コード例 #7
0
 public static void BuildIdentityRoleWithClaims <TEntity, TKey>(this EntityMappingBuilder <TEntity> builder)
     where TKey : IEquatable <TKey>
     where TEntity : class, IIdentityRoleWithClaims <TKey>
 {
     builder.Association(x => x.RoleClaims, k => k.Id, rc => rc.RoleId, false);
 }