public PersonImpl(PersonCountryDemoContext context, string lastName, string firstName)
 {
     this._Context   = context;
     this._LastName  = lastName;
     this._FirstName = firstName;
     context._PersonList.Add(this);
 }
 public CountryImpl(PersonCountryDemoContext context, string countryName)
 {
     this._Context = context;
     this._PersonViaCountryCollection = new ConstraintEnforcementCollection <Country, Person>(this);
     this._CountryName = countryName;
     context.OnCountryCountryNameChanged(this, null);
     context._CountryList.Add(this);
 }
 private bool OnCountryPersonViaCountryCollectionAdding(Country instance, Person item)
 {
     if ((object)this != (object)item.Context)
     {
         throw PersonCountryDemoContext.GetDifferentContextsException("item");
     }
     return(true);
 }
 private bool OnPersonCountryChanging(Person instance, Country newValue)
 {
     if ((object)newValue != null)
     {
         if ((object)this != (object)newValue.Context)
         {
             throw PersonCountryDemoContext.GetDifferentContextsException();
         }
     }
     return(true);
 }
 public Country CreateCountry(string countryName)
 {
     if ((object)countryName == null)
     {
         throw new ArgumentNullException("countryName");
     }
     if (!this.OnCountryCountryNameChanging(null, countryName))
     {
         throw PersonCountryDemoContext.GetConstraintEnforcementFailedException("countryName");
     }
     return(new CountryImpl(this, countryName));
 }
 public Person CreatePerson(string lastName, string firstName)
 {
     if ((object)lastName == null)
     {
         throw new ArgumentNullException("lastName");
     }
     if ((object)firstName == null)
     {
         throw new ArgumentNullException("firstName");
     }
     if (!this.OnPersonLastNameChanging(null, lastName))
     {
         throw PersonCountryDemoContext.GetConstraintEnforcementFailedException("lastName");
     }
     if (!this.OnPersonFirstNameChanging(null, firstName))
     {
         throw PersonCountryDemoContext.GetConstraintEnforcementFailedException("firstName");
     }
     return(new PersonImpl(this, lastName, firstName));
 }
 private static ArgumentException GetDifferentContextsException()
 {
     return(PersonCountryDemoContext.GetDifferentContextsException("value"));
 }