Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Data.Linq;
- using System.Data.Linq.Mapping;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Seminarium;
- namespace Seminarium
- {
- [Table(Name = "Regions")]
- public class Region
- {
- [Column(IsPrimaryKey = true)] public string region_id;
- [Column] public string region_name;
- }
- [Table(Name = "Countires")]
- public class Country
- {
- [Column(IsPrimaryKey = true)] public string country_id;
- [Column] public string country_name;
- [Column] public string region_id;
- private EntityRef<Region> _Regions;
- [Association(Name = "FK_Countries_Regions", Storage = "_Regions", ThisKey = "region_id", IsForeignKey = true)]
- public Region Region
- {
- get
- {
- return this._Regions.Entity;
- }
- set
- {
- Region previousValue = this._Regions.Entity;
- if (((previousValue != value)
- || (this._Regions.HasLoadedOrAssignedValue == false)))
- {
- this.SendPropertyChanging();
- if ((previousValue != null))
- {
- this._Regions.Entity = null;
- previousValue.Region.Remove(this);
- }
- this._Regions.Entity = value;
- if ((value != null))
- {
- value.Country.Add(this);
- this.region_id = value.region_id;
- }
- else
- {
- this.region_id = default(string);
- }
- this.SendPropertyChanged("Region");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement