// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
namespace Microsoft.AspNet.Identity.EntityFramework
{
///
/// Represents a Role entity
///
public class IdentityRole : IdentityRole
{
///
/// Constructor
///
public IdentityRole()
{
Id = Guid.NewGuid().ToString();
}
///
/// Constructor
///
///
public IdentityRole(string roleName) : this()
{
Name = roleName;
}
}
///
/// Represents a Role entity
///
///
public class IdentityRole where TKey : IEquatable
{
public IdentityRole() { }
///
/// Constructor
///
///
public IdentityRole(string roleName) : this()
{
Name = roleName;
}
///
/// Navigation property for users in the role
///
public virtual ICollection> Users { get; } = new List>();
///
/// Navigation property for claims in the role
///
public virtual ICollection> Claims { get; } = new List>();
///
/// Role id
///
public virtual TKey Id { get; set; }
///
/// Role name
///
public virtual string Name { get; set; }
public virtual string NormalizedName { get; set; }
///
/// A random value that should change whenever a role is persisted to the store
///
public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
///
/// Returns a friendly name
///
///
public override string ToString()
{
return Name;
}
}
}