Skip to content

Update to ASP.NET Core 2.0 #7

@KeithT

Description

@KeithT

Just completed (nearly all) your Lynda course (which is excellent by the way) following along using Core 2. I thought you might be interested in a couple of things that break:

In Startup.cs:

        // Add ASP.NET Core Identity
            services.AddIdentity<UserEntity, UserRoleEntity>()
                .AddEntityFrameworkStores<HotelApiContext, Guid>()
                .AddDefaultTokenProviders();

needs to go to:

        // Add ASP.NET Core Identity
            services.AddIdentity<UserEntity, UserRoleEntity>()
                .AddEntityFrameworkStores<HotelApiContext>()
                .AddDefaultTokenProviders();

and in the UsersController.cs:

                var canSeeEveryone = await _authzService
                    .AuthorizeAsync(User, "ViewAllUsersPolicy");
                if (canSeeEveryone)
                {
                    users = await _userService.GetUsersAsync(
                        pagingOptions, sortOptions, searchOptions, ct);
                }

Error CS0029 Cannot implicitly convert type 'Microsoft.AspNetCore.Authorization.AuthorizationResult' to 'bool' bodimecore ...\Controllers\UsersController.cs error

Which I've not had time to look at yet. (Monday hopefully).
Thanks again for the great course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions