So here i defined one model this is the Register Model I am getting one error while adding Migration
using System.ComponentModel.DataAnnotations;
namespace TaskManagementPROJECT.Models
{
public class User
{
public int Id { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(50, ErrorMessage = "Name can't be longer than 50 characters")]
public string Name { get; set; }
[Required(ErrorMessage = "Email is required")]
[EmailAddress(ErrorMessage = "Invalid Email Address")]
public string Email { get; set; }
[Required(ErrorMessage = "Username is required")]
[StringLength(20, ErrorMessage = "Username can't be longer than 20 characters")]
public string Username { get; set; }
[Required(ErrorMessage = "Password is required")]
[StringLength(100, MinimumLength = 6, ErrorMessage = "Password must be between 6 and 100 characters")]
public string Password { get; set; }
public string PhotoPath { get; set; }
[Required(ErrorMessage = "Batch is required")]
public string Batch { get; set; }
[Required(ErrorMessage = "Role is required")]
public string Role { get; set; }
}
}
Error
not able to be constructed (Error while validating the service descriptor ‘ServiceType: Microsoft.AspNetCore.Session.ISessionStore Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Session.DistributedSessionStore’: Unable to resolve service for type ‘Microsoft.Extensions.Caching.Distributed.IDistributedCache’ while attempting to activate ‘Microsoft.AspNetCore.Session.DistributedSessionStore’.)
Unable to create a ‘DbContext’ of type ”. The exception ‘Unable to resolve service for type ‘Microsoft.EntityFrameworkCore.DbContextOptions`1[TaskManagementPROJECT.Data.ApplicationDbContext]’ while attempting to activate ‘TaskManagementPROJECT.Data.ApplicationDbContext’.’ was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Actually i look into my code but didnt get any solution of this so please some one resolve this
mithilesh vishwakarma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.