I am creating a user registry in C #, but when I include the domain layer and I am going to create the migration, the error below is happening. I could not identify what is happening.
"No suitable builder found for entity type 'User'. The following parameters could not be bound to properties of the entity: 'cellPhone', 'address'."
namespace AgendaWeb.Domain.Users
{
public class User
{
public int Id { get; private set; }
public string UserName { get; private set; }
public string FullName { get; private set; }
public string Cpf { get; private set; }
public string Email { get; private set; }
public string Phone { get; private set; }
public string Cellphone { get; private set; }
public string PhotoUrl { get; private set; }
public string Password { get; private set; }
public DateTime RegistrationDate { get; private set; }
public DateTime? DateOfBirth { get; private set; }
public string ProfileType { get; private set; }
public Address Address { get; private set; }
public User(string userName, string fullName, string cpf, string email, string phone, string cellPhone, string photoUrl, string password, DateTime registrationDate, DateTime? dateOfBirth, string profileType, Address address )
{
ValidateValues(userName, fullName, cpf, email, phone, cellPhone, photoUrl, password, registrationDate, dateOfBirth, profileType, address);
SetProperties(userName, fullName, cpf, email, phone, cellPhone, photoUrl, password, registrationDate, dateOfBirth, profileType, address);
}
public void Update(string userName, string fullName, string cpf, string email, string phone, string cellPhone, string photoUrl, string password, DateTime registrationDate, DateTime? dateOfBirth, string profileType, Address address)
{
ValidateValues(userName, fullName, cpf, email, phone, cellPhone, photoUrl, password, registrationDate, dateOfBirth, profileType, address);
SetProperties(userName, fullName, cpf, email, phone, cellPhone, photoUrl, password, registrationDate, dateOfBirth, profileType, address);
}
private void SetProperties(string userName, string fullName, string cpf, string email, string phone, string cellPhone, string photoUrl, string password, DateTime registrationDate, DateTime? dateOfBirth, string profileType, Address address)
{
UserName = userName;
FullName = fullName;
Cpf = cpf;
Email = email;
Phone = phone;
Cellphone = cellPhone;
PhotoUrl = photoUrl;
Password = password;
RegistrationDate = registrationDate;
DateOfBirth = dateOfBirth;
ProfileType = profileType;
Address = address;
}
private static void ValidateValues(string userName, string fullName, string cpf, string email, string phone, string cellPhone, string photoUrl, string password, DateTime registrationDate, DateTime? dateOfBirth, string profileType, Address address)
{
DomainException.When(string.IsNullOrEmpty(userName), "O campo nome é obrigatório!");
}
}
}