Converting regular properties into Catel properties

Catel is extremly powerful, but sometimes the property definitions are lots of work to write down. The code snippets already make your life much easier, but with the Catel.Resharper plugin it might be even easier. You can simply write this code:

public class Person : ModelBase<Person>
{
	public string FirstName { get; set; }
	public string MiddleName { get; set; }
	public string LastName { get; set; }
}

Then hit ALT + Enter and turn properties into Catel properties, which will result in this class:

public class Person : ModelBase<Person>
{
	/// <summary>
	/// Gets or sets the first name.
	/// </summary>
	public string FirstName
	{
		get { return GetValue<string>(FirstNameProperty); }
		set { SetValue(FirstNameProperty, value); }
	}
 
	/// <summary>
	/// Register the FirstName property so it is known in the class.
	/// </summary>
	public static readonly PropertyData FirstNameProperty = RegisterProperty("FirstName", typeof(string));
 
	/// <summary>
	/// Gets or sets the middle name.
	/// </summary>
	public string MiddleName
	{
		get { return GetValue<string>(MiddleNameProperty); }
		set { SetValue(MiddleNameProperty, value); }
	}
 
	/// <summary>
	/// Register the MiddleName property so it is known in the class.
	/// </summary>
	public static readonly PropertyData MiddleNameProperty = RegisterProperty("MiddleName", typeof(string));
 
	/// <summary>
	/// Gets or sets the last name.
	/// </summary>
	public string LastName
	{
		get { return GetValue<string>(LastNameProperty); }
		set { SetValue(LastNameProperty, value); }
	}
 
	/// <summary>
	/// Register the LastName property so it is known in the class.
	/// </summary>
	public static readonly PropertyData LastNameProperty = RegisterProperty("LastName", typeof(string));
}

Note that it is only possible to use this feature on classes deriving from ModelBase, such as ViewModelBase