#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     Ce code a été généré par un outil.
//     Version du runtime :4.0.30319.32559
//
//     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
//     le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SelfMailer.LinqToSql
{
	using System.Data.Linq;
	using System.Data.Linq.Mapping;
	using System.Data;
	using System.Collections.Generic;
	using System.Reflection;
	using System.Linq;
	using System.Linq.Expressions;
	using System.ComponentModel;
	using System;
	
	
	[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="SelfMailer")]
	public partial class SelfMailerDataContext : System.Data.Linq.DataContext
	{
		
		private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
		
    #region Définitions de méthodes d'extensibilité
    partial void OnCreated();
    partial void InsertMailServers(MailServers instance);
    partial void UpdateMailServers(MailServers instance);
    partial void DeleteMailServers(MailServers instance);
    partial void InsertMailServerSender(MailServerSender instance);
    partial void UpdateMailServerSender(MailServerSender instance);
    partial void DeleteMailServerSender(MailServerSender instance);
    partial void InsertSenders(Senders instance);
    partial void UpdateSenders(Senders instance);
    partial void DeleteSenders(Senders instance);
    #endregion
		
		public SelfMailerDataContext() : 
				base(global::SelfMailer.Properties.Settings.Default.SelfMailerConnectionString, mappingSource)
		{
			OnCreated();
		}
		
		public SelfMailerDataContext(string connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public SelfMailerDataContext(System.Data.IDbConnection connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public SelfMailerDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public SelfMailerDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public System.Data.Linq.Table<MailServers> MailServers
		{
			get
			{
				return this.GetTable<MailServers>();
			}
		}
		
		public System.Data.Linq.Table<MailServerSender> MailServerSender
		{
			get
			{
				return this.GetTable<MailServerSender>();
			}
		}
		
		public System.Data.Linq.Table<Senders> Senders
		{
			get
			{
				return this.GetTable<Senders>();
			}
		}
		
		[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.GetLinkedMailServersSenders")]
		public ISingleResult<GetLinkedMailServersSendersResult> GetLinkedMailServersSenders([global::System.Data.Linq.Mapping.ParameterAttribute(Name="MailServerID", DbType="Int")] System.Nullable<int> mailServerID)
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), mailServerID);
			return ((ISingleResult<GetLinkedMailServersSendersResult>)(result.ReturnValue));
		}
	}
	
	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.MailServers")]
	public partial class MailServers : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _ID;
		
		private string _Host;
		
		private string _Username;
		
		private string _Password_Value;
		
		private bool _Password_AllowSave;
		
		private EntitySet<MailServerSender> _MailServerSender;
		
    #region Définitions de méthodes d'extensibilité
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnIDChanging(int value);
    partial void OnIDChanged();
    partial void OnHostChanging(string value);
    partial void OnHostChanged();
    partial void OnUsernameChanging(string value);
    partial void OnUsernameChanged();
    partial void OnPassword_ValueChanging(string value);
    partial void OnPassword_ValueChanged();
    partial void OnPassword_AllowSaveChanging(bool value);
    partial void OnPassword_AllowSaveChanged();
    #endregion
		
		public MailServers()
		{
			this._MailServerSender = new EntitySet<MailServerSender>(new Action<MailServerSender>(this.attach_MailServerSender), new Action<MailServerSender>(this.detach_MailServerSender));
			OnCreated();
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public int ID
		{
			get
			{
				return this._ID;
			}
			set
			{
				if ((this._ID != value))
				{
					this.OnIDChanging(value);
					this.SendPropertyChanging();
					this._ID = value;
					this.SendPropertyChanged("ID");
					this.OnIDChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Host", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Host
		{
			get
			{
				return this._Host;
			}
			set
			{
				if ((this._Host != value))
				{
					this.OnHostChanging(value);
					this.SendPropertyChanging();
					this._Host = value;
					this.SendPropertyChanged("Host");
					this.OnHostChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Username", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Username
		{
			get
			{
				return this._Username;
			}
			set
			{
				if ((this._Username != value))
				{
					this.OnUsernameChanging(value);
					this.SendPropertyChanging();
					this._Username = value;
					this.SendPropertyChanged("Username");
					this.OnUsernameChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Password_Value", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Password_Value
		{
			get
			{
				return this._Password_Value;
			}
			set
			{
				if ((this._Password_Value != value))
				{
					this.OnPassword_ValueChanging(value);
					this.SendPropertyChanging();
					this._Password_Value = value;
					this.SendPropertyChanged("Password_Value");
					this.OnPassword_ValueChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Password_AllowSave", DbType="Bit NOT NULL")]
		public bool Password_AllowSave
		{
			get
			{
				return this._Password_AllowSave;
			}
			set
			{
				if ((this._Password_AllowSave != value))
				{
					this.OnPassword_AllowSaveChanging(value);
					this.SendPropertyChanging();
					this._Password_AllowSave = value;
					this.SendPropertyChanged("Password_AllowSave");
					this.OnPassword_AllowSaveChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="MailServers_MailServerSender", Storage="_MailServerSender", ThisKey="ID", OtherKey="MailServer_ID")]
		public EntitySet<MailServerSender> MailServerSender
		{
			get
			{
				return this._MailServerSender;
			}
			set
			{
				this._MailServerSender.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_MailServerSender(MailServerSender entity)
		{
			this.SendPropertyChanging();
			entity.MailServers = this;
		}
		
		private void detach_MailServerSender(MailServerSender entity)
		{
			this.SendPropertyChanging();
			entity.MailServers = null;
		}
	}
	
	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.MailServerSender")]
	public partial class MailServerSender : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _MailServer_ID;
		
		private int _Sender_ID;
		
		private EntityRef<MailServers> _MailServers;
		
		private EntityRef<Senders> _Senders;
		
    #region Définitions de méthodes d'extensibilité
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnMailServer_IDChanging(int value);
    partial void OnMailServer_IDChanged();
    partial void OnSender_IDChanging(int value);
    partial void OnSender_IDChanged();
    #endregion
		
		public MailServerSender()
		{
			this._MailServers = default(EntityRef<MailServers>);
			this._Senders = default(EntityRef<Senders>);
			OnCreated();
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MailServer_ID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int MailServer_ID
		{
			get
			{
				return this._MailServer_ID;
			}
			set
			{
				if ((this._MailServer_ID != value))
				{
					if (this._MailServers.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnMailServer_IDChanging(value);
					this.SendPropertyChanging();
					this._MailServer_ID = value;
					this.SendPropertyChanged("MailServer_ID");
					this.OnMailServer_IDChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Sender_ID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int Sender_ID
		{
			get
			{
				return this._Sender_ID;
			}
			set
			{
				if ((this._Sender_ID != value))
				{
					if (this._Senders.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnSender_IDChanging(value);
					this.SendPropertyChanging();
					this._Sender_ID = value;
					this.SendPropertyChanged("Sender_ID");
					this.OnSender_IDChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="MailServers_MailServerSender", Storage="_MailServers", ThisKey="MailServer_ID", OtherKey="ID", IsForeignKey=true)]
		public MailServers MailServers
		{
			get
			{
				return this._MailServers.Entity;
			}
			set
			{
				MailServers previousValue = this._MailServers.Entity;
				if (((previousValue != value) 
							|| (this._MailServers.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._MailServers.Entity = null;
						previousValue.MailServerSender.Remove(this);
					}
					this._MailServers.Entity = value;
					if ((value != null))
					{
						value.MailServerSender.Add(this);
						this._MailServer_ID = value.ID;
					}
					else
					{
						this._MailServer_ID = default(int);
					}
					this.SendPropertyChanged("MailServers");
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Senders_MailServerSender", Storage="_Senders", ThisKey="Sender_ID", OtherKey="ID", IsForeignKey=true)]
		public Senders Senders
		{
			get
			{
				return this._Senders.Entity;
			}
			set
			{
				Senders previousValue = this._Senders.Entity;
				if (((previousValue != value) 
							|| (this._Senders.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Senders.Entity = null;
						previousValue.MailServerSender.Remove(this);
					}
					this._Senders.Entity = value;
					if ((value != null))
					{
						value.MailServerSender.Add(this);
						this._Sender_ID = value.ID;
					}
					else
					{
						this._Sender_ID = default(int);
					}
					this.SendPropertyChanged("Senders");
				}
			}
		}
		
		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));
			}
		}
	}
	
	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Senders")]
	public partial class Senders : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _ID;
		
		private string _Name;
		
		private string _Email;
		
		private EntitySet<MailServerSender> _MailServerSender;
		
    #region Définitions de méthodes d'extensibilité
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnIDChanging(int value);
    partial void OnIDChanged();
    partial void OnNameChanging(string value);
    partial void OnNameChanged();
    partial void OnEmailChanging(string value);
    partial void OnEmailChanged();
    #endregion
		
		public Senders()
		{
			this._MailServerSender = new EntitySet<MailServerSender>(new Action<MailServerSender>(this.attach_MailServerSender), new Action<MailServerSender>(this.detach_MailServerSender));
			OnCreated();
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public int ID
		{
			get
			{
				return this._ID;
			}
			set
			{
				if ((this._ID != value))
				{
					this.OnIDChanging(value);
					this.SendPropertyChanging();
					this._ID = value;
					this.SendPropertyChanged("ID");
					this.OnIDChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Name
		{
			get
			{
				return this._Name;
			}
			set
			{
				if ((this._Name != value))
				{
					this.OnNameChanging(value);
					this.SendPropertyChanging();
					this._Name = value;
					this.SendPropertyChanged("Name");
					this.OnNameChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Email", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Email
		{
			get
			{
				return this._Email;
			}
			set
			{
				if ((this._Email != value))
				{
					this.OnEmailChanging(value);
					this.SendPropertyChanging();
					this._Email = value;
					this.SendPropertyChanged("Email");
					this.OnEmailChanged();
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Senders_MailServerSender", Storage="_MailServerSender", ThisKey="ID", OtherKey="Sender_ID")]
		public EntitySet<MailServerSender> MailServerSender
		{
			get
			{
				return this._MailServerSender;
			}
			set
			{
				this._MailServerSender.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_MailServerSender(MailServerSender entity)
		{
			this.SendPropertyChanging();
			entity.Senders = this;
		}
		
		private void detach_MailServerSender(MailServerSender entity)
		{
			this.SendPropertyChanging();
			entity.Senders = null;
		}
	}
	
	public partial class GetLinkedMailServersSendersResult
	{
		
		private int _ID;
		
		private string _Host;
		
		private string _Username;
		
		private string _Password_Value;
		
		private bool _Password_AllowSave;
		
		private int _ID1;
		
		private string _Name;
		
		private string _Email;
		
		public GetLinkedMailServersSendersResult()
		{
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID", DbType="Int NOT NULL")]
		public int ID
		{
			get
			{
				return this._ID;
			}
			set
			{
				if ((this._ID != value))
				{
					this._ID = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Host", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Host
		{
			get
			{
				return this._Host;
			}
			set
			{
				if ((this._Host != value))
				{
					this._Host = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Username", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Username
		{
			get
			{
				return this._Username;
			}
			set
			{
				if ((this._Username != value))
				{
					this._Username = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Password_Value", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Password_Value
		{
			get
			{
				return this._Password_Value;
			}
			set
			{
				if ((this._Password_Value != value))
				{
					this._Password_Value = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Password_AllowSave", DbType="Bit NOT NULL")]
		public bool Password_AllowSave
		{
			get
			{
				return this._Password_AllowSave;
			}
			set
			{
				if ((this._Password_AllowSave != value))
				{
					this._Password_AllowSave = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID1", DbType="Int NOT NULL")]
		public int ID1
		{
			get
			{
				return this._ID1;
			}
			set
			{
				if ((this._ID1 != value))
				{
					this._ID1 = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Name
		{
			get
			{
				return this._Name;
			}
			set
			{
				if ((this._Name != value))
				{
					this._Name = value;
				}
			}
		}
		
		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Email", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
		public string Email
		{
			get
			{
				return this._Email;
			}
			set
			{
				if ((this._Email != value))
				{
					this._Email = value;
				}
			}
		}
	}
}
#pragma warning restore 1591
