Tôi đang cố gắng di chuyển IdentityModels.cs sang một dự án khác để giữ cho trang web tách biệt khỏi Lớp Truy cập Dữ liệu.Hình thức Web ASP.NET và Nhận dạng: Di chuyển IdentityModels.cs sang một dự án khác
Tôi đi theo hướng dẫn này: http://blog.rebuildall.net/2013/10/22/Moving_ASP_NET_Identity_model_into_another_assembly
Và cũng đã kiểm tra câu hỏi này ở đây: How to move MVC 5 IdentityModels.cs into a separate assembly
Nhưng tôi vẫn bối rối vì IdentityModels tài liệu tham khảo khác lớp được gọi là ApplicationUserManager như bạn có thể nhìn thấy dưới đây:
public class ApplicationUser : IdentityUser
{
public ClaimsIdentity GenerateUserIdentity(ApplicationUserManager manager)
{
//code removed for simplicity
}
}
Khi tôi đi tìm lớp học đó, tôi đã tìm thấy nó trong dự án trang web bên trong một lớp học nằm ở: App_Start/IdentityConfig.cs
//...More code in the upper section
public class SmsService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
// Plug in your SMS service here to send a text message.
return Task.FromResult(0);
}
}
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
public class ApplicationUserManager : UserManager<ApplicationUser>
{
public ApplicationUserManager(IUserStore<ApplicationUser> store)
: base(store)
{
}
//More code bellow this...
Bây giờ, điều này mang tôi đến đây vì tôi thực sự bị mất trong khuôn khổ ASP NET nhận dạng mới và tôi đã phải vật lộn với những thứ thực sự đơn giản mà dường như không đơn giản như vậy.
Làm cách nào để di chuyển IdentityModel sang một dự án khác mà không làm rối tung trang web của tôi ??
Một số dữ liệu bổ sung:
- Sử dụng VS 2013 Cộng đồng
- Sử dụng .NET Framework 4.5.1
Tôi gặp vấn đề tương tự. Tôi đang làm việc trên nó, Nếu tôi nhận được một câu trả lời tôi sẽ đăng nó. – EduLopez