How do you know that a person doesn't enter three or four names? A lot of people have middle names. How would you handle that logically? What about people with names where their last name is two parts like Van Pelt or Saint James?
If you can somehow define that, you can use logic in your setter for the Name property. When it's set, split it to its various parts. Here's a simple example:
public class NameExample
{
private string name;
private string firstName;
private string lastName;
public string Name
{
get { return name; }
set
{
if( value != name )
{
name = value;
if (string.IsNullOrEmpty(name)) return;
var names = name.Split(' ');
firstName = names[0];
if (names.Length > 1) lastName = names[1]; // Is our person Cher? ;-)
}
}
}
public string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
name = firstName + (string.IsNullOrEmpty(lastName) ? "" : " " + lastName);
}
}
public string LastName
{
get => lastName;
set {
lastName = value;
name = firstName + (string.IsNullOrEmpty(lastName) ? "" : " " + lastName);
}
}
You can do this with Entity Framework since it actually calls the setters for the properties when it loads the values from the database. And it calls the getters to get the values to write to the database. This is why you must use public properties instead of public fields for domain models.
My example is deliberately verbose and quick. You can fine tune it hoever you want.