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

📄 addressbook.designer.cs

📁 us as a a a a a a a a aa a a a a a a a a a aa a a a a a a a a
💻 CS
📖 第 1 页 / 共 2 页
字号:
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3031
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;



[System.Data.Linq.Mapping.DatabaseAttribute(Name="AddressBook")]
public partial class AddressBookDataContext : System.Data.Linq.DataContext
{
	
	private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
	
  #region Extensibility Method Definitions
  partial void OnCreated();
  partial void InsertCategory(Category instance);
  partial void UpdateCategory(Category instance);
  partial void DeleteCategory(Category instance);
  partial void InsertContact(Contact instance);
  partial void UpdateContact(Contact instance);
  partial void DeleteContact(Contact instance);
  #endregion
	
	public AddressBookDataContext() : 
			base(global::System.Configuration.ConfigurationManager.ConnectionStrings["AddressBookConnectionString"].ConnectionString, mappingSource)
	{
		OnCreated();
	}
	
	public AddressBookDataContext(string connection) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public AddressBookDataContext(System.Data.IDbConnection connection) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public AddressBookDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public AddressBookDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public System.Data.Linq.Table<Category> Categories
	{
		get
		{
			return this.GetTable<Category>();
		}
	}
	
	public System.Data.Linq.Table<Contact> Contacts
	{
		get
		{
			return this.GetTable<Contact>();
		}
	}
}

[Table(Name="dbo.Categories")]
public partial class Category : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _CategoryId;
	
	private string _Name;
	
	private System.Nullable<int> _ListOrder;
	
	private EntitySet<Contact> _Contacts;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnCategoryIdChanging(int value);
    partial void OnCategoryIdChanged();
    partial void OnNameChanging(string value);
    partial void OnNameChanged();
    partial void OnListOrderChanging(System.Nullable<int> value);
    partial void OnListOrderChanged();
    #endregion
	
	public Category()
	{
		this._Contacts = new EntitySet<Contact>(new Action<Contact>(this.attach_Contacts), new Action<Contact>(this.detach_Contacts));
		OnCreated();
	}
	
	[Column(Storage="_CategoryId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int CategoryId
	{
		get
		{
			return this._CategoryId;
		}
		set
		{
			if ((this._CategoryId != value))
			{
				this.OnCategoryIdChanging(value);
				this.SendPropertyChanging();
				this._CategoryId = value;
				this.SendPropertyChanged("CategoryId");
				this.OnCategoryIdChanged();
			}
		}
	}
	
	[Column(Storage="_Name", DbType="NVarChar(20) 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();
			}
		}
	}
	
	[Column(Storage="_ListOrder", DbType="Int")]
	public System.Nullable<int> ListOrder
	{
		get
		{
			return this._ListOrder;
		}
		set
		{
			if ((this._ListOrder != value))
			{
				this.OnListOrderChanging(value);
				this.SendPropertyChanging();
				this._ListOrder = value;
				this.SendPropertyChanged("ListOrder");
				this.OnListOrderChanged();
			}
		}
	}
	
	[Association(Name="Category_Contact", Storage="_Contacts", OtherKey="CategoryId")]
	public EntitySet<Contact> Contacts
	{
		get
		{
			return this._Contacts;
		}
		set
		{
			this._Contacts.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_Contacts(Contact entity)
	{
		this.SendPropertyChanging();
		entity.Category = this;
	}
	
	private void detach_Contacts(Contact entity)
	{
		this.SendPropertyChanging();
		entity.Category = null;
	}
}

[Table(Name="dbo.Contacts")]
public partial class Contact : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _ContactId;
	
	private int _CategoryId;
	
	private string _FirstName;
	
	private string _LastName;
	
	private string _Company;
	
	private string _Title;
	
	private string _Address;
	
	private string _City;
	
	private string _State;
	
	private string _Zip;
	
	private string _HomePhone;
	
	private string _WorkPhone;
	
	private string _MobilePhone;
	
	private string _EmailAddress;
	
	private string _WebSite;
	
	private System.DateTime _Birthdate;
	
	private System.Nullable<System.DateTime> _Anniversary;
	
	private EntityRef<Category> _Category;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnContactIdChanging(int value);
    partial void OnContactIdChanged();
    partial void OnCategoryIdChanging(int value);
    partial void OnCategoryIdChanged();
    partial void OnFirstNameChanging(string value);
    partial void OnFirstNameChanged();
    partial void OnLastNameChanging(string value);
    partial void OnLastNameChanged();
    partial void OnCompanyChanging(string value);
    partial void OnCompanyChanged();
    partial void OnTitleChanging(string value);
    partial void OnTitleChanged();
    partial void OnAddressChanging(string value);
    partial void OnAddressChanged();
    partial void OnCityChanging(string value);
    partial void OnCityChanged();
    partial void OnStateChanging(string value);
    partial void OnStateChanged();
    partial void OnZipChanging(string value);
    partial void OnZipChanged();
    partial void OnHomePhoneChanging(string value);
    partial void OnHomePhoneChanged();
    partial void OnWorkPhoneChanging(string value);
    partial void OnWorkPhoneChanged();
    partial void OnMobilePhoneChanging(string value);
    partial void OnMobilePhoneChanged();
    partial void OnEmailAddressChanging(string value);
    partial void OnEmailAddressChanged();
    partial void OnWebSiteChanging(string value);
    partial void OnWebSiteChanged();
    partial void OnBirthdateChanging(System.DateTime value);
    partial void OnBirthdateChanged();
    partial void OnAnniversaryChanging(System.Nullable<System.DateTime> value);
    partial void OnAnniversaryChanged();
    #endregion
	
	public Contact()
	{
		this._Category = default(EntityRef<Category>);
		OnCreated();
	}
	
	[Column(Storage="_ContactId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int ContactId
	{
		get
		{
			return this._ContactId;
		}
		set
		{
			if ((this._ContactId != value))
			{
				this.OnContactIdChanging(value);
				this.SendPropertyChanging();
				this._ContactId = value;
				this.SendPropertyChanged("ContactId");
				this.OnContactIdChanged();
			}
		}
	}
	
	[Column(Storage="_CategoryId", DbType="Int NOT NULL")]
	public int CategoryId
	{
		get
		{
			return this._CategoryId;
		}
		set
		{
			if ((this._CategoryId != value))
			{
				if (this._Category.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnCategoryIdChanging(value);
				this.SendPropertyChanging();
				this._CategoryId = value;
				this.SendPropertyChanged("CategoryId");
				this.OnCategoryIdChanged();
			}
		}
	}
	

⌨️ 快捷键说明

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