⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datamapping.designer.cs

📁 经典游戏程序设计:visual c++ 上的杀人游戏源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
			{
				return this._Game.Entity;
			}
			set
			{
				Game previousValue = this._Game.Entity;
				if (((previousValue != value) 
							|| (this._Game.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Game.Entity = null;
						previousValue.Players.Remove(this);
					}
					this._Game.Entity = value;
					if ((value != null))
					{
						value.Players.Add(this);
						this._GameNo = value.GameNo;
					}
					else
					{
						this._GameNo = default(int);
					}
					this.SendPropertyChanged("Game");
				}
			}
		}
		
		[Association(Name="User_Player", Storage="_Player", ThisKey="UserID", IsForeignKey=true)]
		public User User
		{
			get
			{
				return this._Player.Entity;
			}
			set
			{
				User previousValue = this._Player.Entity;
				if (((previousValue != value) 
							|| (this._Player.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Player.Entity = null;
						previousValue.Players.Remove(this);
					}
					this._Player.Entity = value;
					if ((value != null))
					{
						value.Players.Add(this);
						this._UserID = value.UserID;
					}
					else
					{
						this._UserID = default(string);
					}
					this.SendPropertyChanged("User");
				}
			}
		}
		
		[Association(Name="Role_Player", Storage="_Role", ThisKey="RoleID", IsForeignKey=true)]
		public Role Role
		{
			get
			{
				return this._Role.Entity;
			}
			set
			{
				Role previousValue = this._Role.Entity;
				if (((previousValue != value) 
							|| (this._Role.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Role.Entity = null;
						previousValue.Players.Remove(this);
					}
					this._Role.Entity = value;
					if ((value != null))
					{
						value.Players.Add(this);
						this._RoleID = value.RoleID;
					}
					else
					{
						this._RoleID = default(int);
					}
					this.SendPropertyChanged("Role");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
	
	[Table(Name="dbo.Vote")]
	public partial class Vote : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _ActivityNo;
		
		private int _RoundNo;
		
		private string _Voter;
		
		private string _Candidate;
		
		private EntityRef<Activity> _Activity;
		
		private EntityRef<User> _User;
		
		private EntityRef<User> _User1;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnActivityNoChanging(int value);
    partial void OnActivityNoChanged();
    partial void OnRoundNoChanging(int value);
    partial void OnRoundNoChanged();
    partial void OnVoterChanging(string value);
    partial void OnVoterChanged();
    partial void OnCandidateChanging(string value);
    partial void OnCandidateChanged();
    #endregion
		
		public Vote()
		{
			this._Activity = default(EntityRef<Activity>);
			this._User = default(EntityRef<User>);
			this._User1 = default(EntityRef<User>);
			OnCreated();
		}
		
		[Column(Storage="_ActivityNo", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int ActivityNo
		{
			get
			{
				return this._ActivityNo;
			}
			set
			{
				if ((this._ActivityNo != value))
				{
					if (this._Activity.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnActivityNoChanging(value);
					this.SendPropertyChanging();
					this._ActivityNo = value;
					this.SendPropertyChanged("ActivityNo");
					this.OnActivityNoChanged();
				}
			}
		}
		
		[Column(Storage="_RoundNo", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int RoundNo
		{
			get
			{
				return this._RoundNo;
			}
			set
			{
				if ((this._RoundNo != value))
				{
					this.OnRoundNoChanging(value);
					this.SendPropertyChanging();
					this._RoundNo = value;
					this.SendPropertyChanged("RoundNo");
					this.OnRoundNoChanged();
				}
			}
		}
		
		[Column(Storage="_Voter", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
		public string Voter
		{
			get
			{
				return this._Voter;
			}
			set
			{
				if ((this._Voter != value))
				{
					if (this._User.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnVoterChanging(value);
					this.SendPropertyChanging();
					this._Voter = value;
					this.SendPropertyChanged("Voter");
					this.OnVoterChanged();
				}
			}
		}
		
		[Column(Storage="_Candidate", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
		public string Candidate
		{
			get
			{
				return this._Candidate;
			}
			set
			{
				if ((this._Candidate != value))
				{
					if (this._User1.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnCandidateChanging(value);
					this.SendPropertyChanging();
					this._Candidate = value;
					this.SendPropertyChanged("Candidate");
					this.OnCandidateChanged();
				}
			}
		}
		
		[Association(Name="Activity_Vote", Storage="_Activity", ThisKey="ActivityNo", IsForeignKey=true)]
		public Activity Activity
		{
			get
			{
				return this._Activity.Entity;
			}
			set
			{
				Activity previousValue = this._Activity.Entity;
				if (((previousValue != value) 
							|| (this._Activity.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Activity.Entity = null;
						previousValue.Votes.Remove(this);
					}
					this._Activity.Entity = value;
					if ((value != null))
					{
						value.Votes.Add(this);
						this._ActivityNo = value.ActivityNo;
					}
					else
					{
						this._ActivityNo = default(int);
					}
					this.SendPropertyChanged("Activity");
				}
			}
		}
		
		[Association(Name="User_Vote", Storage="_User", ThisKey="Voter", IsForeignKey=true)]
		public User User
		{
			get
			{
				return this._User.Entity;
			}
			set
			{
				User previousValue = this._User.Entity;
				if (((previousValue != value) 
							|| (this._User.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._User.Entity = null;
						previousValue.Votes.Remove(this);
					}
					this._User.Entity = value;
					if ((value != null))
					{
						value.Votes.Add(this);
						this._Voter = value.UserID;
					}
					else
					{
						this._Voter = default(string);
					}
					this.SendPropertyChanged("User");
				}
			}
		}
		
		[Association(Name="User_Vote1", Storage="_User1", ThisKey="Candidate", IsForeignKey=true)]
		public User User1
		{
			get
			{
				return this._User1.Entity;
			}
			set
			{
				User previousValue = this._User1.Entity;
				if (((previousValue != value) 
							|| (this._User1.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._User1.Entity = null;
						previousValue.Votes1.Remove(this);
					}
					this._User1.Entity = value;
					if ((value != null))
					{
						value.Votes1.Add(this);
						this._Candidate = value.UserID;
					}
					else
					{
						this._Candidate = default(string);
					}
					this.SendPropertyChanged("User1");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
	
	[Table(Name="")]
	public partial class GameStatus : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _StatusID;
		
		private string _StatusName;
		
		private EntitySet<Game> _Games;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnStatusIDChanging(int value);
    partial void OnStatusIDChanged();
    partial void OnStatusNameChanging(string value);
    partial void OnStatusNameChanged();
    #endregion
		
		public GameStatus()
		{
			this._Games = new EntitySet<Game>(new Action<Game>(this.attach_Games), new Action<Game>(this.detach_Games));
			OnCreated();
		}
		
		[Column(Storage="_StatusID", DbType="Int", IsPrimaryKey=true)]
		public int StatusID
		{
			get
			{
				return this._StatusID;
			}
			set
			{
				if ((this._StatusID != value))
				{
					this.OnStatusIDChanging(value);
					this.SendPropertyChanging();
					this._StatusID = value;
					this.SendPropertyChanged("StatusID");
					this.OnStatusIDChanged();
				}
			}
		}
		
		[Column(Storage="_StatusName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
		public string StatusName
		{
			get
			{
				return this._StatusName;
			}
			set
			{
				if ((this._StatusName != value))
				{
					this.OnStatusNameChanging(value);
					this.SendPropertyChanging();
					this._StatusName = value;
					this.SendPropertyChanged("StatusName");
					this.OnStatusNameChanged();
				}
			}
		}
		
		[Association(Name="GameStatus_Game", Storage="_Games", OtherKey="GameStatus")]
		public EntitySet<Game> Games
		{
			get
			{
				return this._Games;
			}
			set
			{
				this._Games.Assign(value);
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Games(Game entity)
		{
			this.SendPropertyChanging();
			entity.GameStatus1 = this;
		}
		
		private void detach_Games(Game entity)
		{
			this.SendPropertyChanging();
			entity.GameStatus1 = null;
		}
	}
}
#pragma warning restore 1591

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -