aspnet / Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.96k stars 869 forks source link

'IdentityRole.cs' does not set 'NormalizedName' when using constructor 'Role(string roleName)' #1936

Closed mvonck closed 6 years ago

mvonck commented 6 years ago

In IdentityRole.cs the following code:

        /// <summary>
        /// Initializes a new instance of <see cref="IdentityRole"/>.
        /// </summary>
        /// <param name="roleName">The role name.</param>
        /// <remarks>
        /// The Id property is initialized to form a new GUID string value.
        /// </remarks>
        public IdentityRole(string roleName) : this()
        {
            Name = roleName;
        }

should be:

        /// <summary>
        /// Initializes a new instance of <see cref="IdentityRole"/>.
        /// </summary>
        /// <param name="roleName">The role name.</param>
        /// <remarks>
        /// The Id property is initialized to form a new GUID string value.
        /// </remarks>
        public IdentityRole(string roleName) : this()
        {
            Name = roleName;
            NormalizedName = roleName.ToUpperInvariant();
        }
HaoK commented 6 years ago

This is expected, the POCO isn't responsible for any of that manipulation, the managers are responsible for setting the normalized columns.