사용자 용 UserController 및 Views를 비계하려고 노력하고 있습니다. 처음에는 컨트롤러를 스 캐 폴딩 할 때 "형식 당 여러 개체 세트가 지원되지 않습니다."라는 오류가 표시됩니다. (이것은 ApplicationUser 및 User와 관련이 있습니다.) Areas/Admin에서 컨트롤러를 비계하려고합니다.형식 당 여러 개체 집합
그런 다음 StackOverflow에서 ApplicationUser 클래스의 이름을 User로 변경하여 많은 오류가 발생했습니다. 나는 ApplicationUser에 대한 모든 참조를 User로 변경했지만 여전히 동일한 오류가 발생합니다. 다시 ApplicationUser로 변경하고, 그것을 다시 스캐 폴딩하려고 시도했습니다 (컨트롤러에서 Area/Admin 대신). 그것은 응용 프로그램을 실행하기 전까지는 효과가있는 것처럼 보였습니다. 그것은 나에게 똑같은 오류를 준다.
using System.Data.Entity;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
namespace ImpHer.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
public string PostalCode { get; set; }
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
public System.Data.Entity.DbSet<ImpHer.Models.Project> Projects { get; set; }
public System.Data.Entity.DbSet<ImpHer.Models.Category> Categories { get; set; }
public System.Data.Entity.DbSet<ImpHer.Models.ApplicationUser> ApplicationUsers { get; set; }
}
}
이것은 IdentityModels.cs
입니다. 누가 도와 드릴 수 있습니까?
어디에서 예외가 발생합니까? –
선택한 코드 생성기를 실행하는 동안 오류가 발생했습니다 : ''Models.ApplicationUser '에 대한 메타 데이터를 검색 할 수 없습니다. 유형 당 여러 오브젝트 세트는 지원되지 않습니다. 개체 집합 'ApplicationUsers'및 'Users'모두 'Models.ApplicationUser'형식의 인스턴스를 포함 할 수 있습니다. –