Created
September 5, 2012 02:56
-
-
Save codewithcats/3629584 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter05.Listing05_47 | |
{ | |
using System; | |
// File: Person.Designer.cs | |
public partial class Person | |
{ | |
#region Extensibility Method Definitions | |
partial void OnLastNameChanging(string value); | |
partial void OnFirstNameChanging(string value); | |
#endregion | |
// ... | |
public System.Guid PersonId{ get; set;} | |
private System.Guid _PersonId; | |
// ... | |
public string LastName | |
{ | |
get | |
{ | |
return _LastName; | |
} | |
set | |
{ | |
if ((_LastName != value)) | |
{ | |
OnLastNameChanging(value); | |
_LastName = value; | |
} | |
} | |
} | |
private string _LastName; | |
// ... | |
public string FirstName | |
{ | |
get | |
{ | |
return _FirstName; | |
} | |
set | |
{ | |
if ((_FirstName != value)) | |
{ | |
OnFirstNameChanging(value); | |
_FirstName = value; | |
} | |
} | |
} | |
private string _FirstName; | |
} | |
// File: Person.cs | |
partial class Person | |
{ | |
partial void OnLastNameChanging(string value) | |
{ | |
if (value == null) | |
{ | |
throw new ArgumentNullException("LastName"); | |
} | |
if (value.Trim().Length == 0) | |
{ | |
throw new ArgumentException( | |
"LastName cannot be empty."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment