C# 此参数为.SendPropertyChanging(); 这是。_CustomerID=值; 此.SendPropertyChanged(“CustomerID”); this.OnCustomerIDChanged(); } } } [global::S
此参数为.SendPropertyChanging(); 这是。_CustomerID=值; 此.SendPropertyChanged(“CustomerID”); this.OnCustomerIDChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u CompanyName”, DbType=“NVarChar(40)非空”,CanBeNull=false)] 公共字符串公司名 { 得到 { 返回此。\u CompanyName; } 设置 { if((此._CompanyName!=值)) { 此.OnCompanyNameChanging(值); 此参数为.SendPropertyChanging(); 此._CompanyName=值; 此。SendPropertyChanged(“公司名称”); this.OnCompanyNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(存储=“\u ContactName”, DbType=“NVarChar(30)”)] 公共字符串联系人名称 { 得到 { 返回此。\u ContactName; } 设置 { 如果((此._ContactName!=值)) { 此.onContactNameChanged(值); 此参数为.SendPropertyChanging(); 这是。_ContactName=值; 此。SendPropertyChanged(“联系人姓名”); this.OnContactNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(存储=“\u ContactTitle”, DbType=“NVarChar(30)”)] 公共字符串ContactTitle { 得到 { 返回此。\u ContactTitle; } 设置 { 如果((此._ContactTitle!=值)) { 此.onContactTitleChange(值); 此参数为.SendPropertyChanging(); 这。_ContactTitle=值; 此。SendPropertyChanged(“ContactTitle”); 此.OnContactTitleChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u Address”, DbType=“NVarChar(60)”)] 公共字符串地址 { 得到 { 返回此地址; } 设置 { if((此地址!=值)) { 此.onAddressChangeing(值); 此参数为.SendPropertyChanging(); 这个地址=值; 此。SendPropertyChanged(“地址”); 此.OnAddressChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u City”, DbType=“NVarChar(15)”)] 公共字符串城市 { 得到 { 把这个还给你; } 设置 { 如果((这个城市!=值)) { 此项。oncitychange(值); 此参数为.SendPropertyChanging(); 这个城市=价值; 本。SendProperty变更(“城市”); this.OnCityChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u Region”, DbType=“NVarChar(15)”)] 公共字符串区域 { 得到 { 返回此区域; } 设置 { if((此._区域!=值)) { 这是区域变化(值); 此参数为.SendPropertyChanging(); 此区域=值; 此项。SendProperty变更(“区域”); this.OnRegionChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(存储=“\u PostalCode”, DbType=“NVarChar(10)”)] 公共字符串后代码 { 得到 { 将此返回。\u PostalCode; } 设置 { if((此.\u PostalCode!=值)) { 这是一个月后的交易(价值); 此参数为.SendPropertyChanging(); 这。_PostalCode=值; 此。SendPropertyChanged(“PostalCode”); 此.OnPostalCodeChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u Country”, DbType=“NVarChar(15)”)] 公共字符串国家 { 得到 { 把这个还给你的国家; } 设置 { 如果((此._国家!=值)) { 此参数为OnCountryChange(值); 此参数为.SendPropertyChanging(); 这个国家=价值; 此项。SendProperty变更(“国家”); this.OnCountryChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u Phone”, DbType=“NVarChar(24)”)] 公用串电话 { 得到 { 把这个还给我; } 设置 { 如果((此._Phone!=值)) { 此.OnPhoneChanging(值); 此参数为.SendPropertyChanging(); 这个。_Phone=值; 此。SendPropertyChanged(“电话”); this.OnPhoneChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u Fax”, DbType=“NVarChar(24)”)] 公共字符串传真 { 得到 { 把这个还给我; } 设置 { 如果((此._Fax!=值)) { 此参数正在更改(值); 此参数为.SendPropertyChanging(); 这个。_Fax=值; 此。发送属性已更改(“传真”); 这个.OnFaxChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u Image”, DbType=“NVarChar(50)”)] 公共字符串图像 { 得到 { 返回此。\u图像; } 设置 { if((此._图像!=值)) { 这是一个不断变化的(值); 此参数为.SendPropertyChanging();C# 此参数为.SendPropertyChanging(); 这是。_CustomerID=值; 此.SendPropertyChanged(“CustomerID”); this.OnCustomerIDChanged(); } } } [global::S,c#,asp.net,objectdatasource,C#,Asp.net,Objectdatasource,此参数为.SendPropertyChanging(); 这是。_CustomerID=值; 此.SendPropertyChanged(“CustomerID”); this.OnCustomerIDChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage=“\u CompanyName”, DbType=“NVarChar(40)非空”,CanBeNull=false)] 公共字符串公司名 { 得到
// Here is my code for BAL.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;
using Northwind;
public class BAL
{
public List<String> GetCountries()
{
using (var context = new NorthwindDataContext())
{
return (from c in context.Customers
select c.Country).Distinct().ToList();
}
}
public List<Customer> GetCustomersByCountry(string country)
{
using (var context = new NorthwindDataContext())
{
return (from c in context.Customers
where c.Country == country
select c).ToList();
}
}
public Customer GetCustomer(string custID)
{
using (var context = new NorthwindDataContext())
{
return (from c in context.Customers
where c.CustomerID == custID
select c).SingleOrDefault();
}
}
}
}
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Northwind
{
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="Northwind")]
public partial class NorthwindDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new
AttributeMappingSource();
#region Extensibility Method Definitions
partial void OnCreated();
partial void InsertCustomer(Customer instance);
partial void UpdateCustomer(Customer instance);
partial void DeleteCustomer(Customer instance);
#endregion
public NorthwindDataContext() :
base
(global::System.Configuration.ConfigurationManager.ConnectionStrings
["NorthwindConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(string connection,
System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(System.Data.IDbConnection connection,
System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public System.Data.Linq.Table<Customer> Customers
{
get
{
return this.GetTable<Customer>();
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Customers")]
public partial class Customer : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new
PropertyChangingEventArgs(String.Empty);
private string _CustomerID;
private string _CompanyName;
private string _ContactName;
private string _ContactTitle;
private string _Address;
private string _City;
private string _Region;
private string _PostalCode;
private string _Country;
private string _Phone;
private string _Fax;
private string _Image;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnCustomerIDChanging(string value);
partial void OnCustomerIDChanged();
partial void OnCompanyNameChanging(string value);
partial void OnCompanyNameChanged();
partial void OnContactNameChanging(string value);
partial void OnContactNameChanged();
partial void OnContactTitleChanging(string value);
partial void OnContactTitleChanged();
partial void OnAddressChanging(string value);
partial void OnAddressChanged();
partial void OnCityChanging(string value);
partial void OnCityChanged();
partial void OnRegionChanging(string value);
partial void OnRegionChanged();
partial void OnPostalCodeChanging(string value);
partial void OnPostalCodeChanged();
partial void OnCountryChanging(string value);
partial void OnCountryChanged();
partial void OnPhoneChanging(string value);
partial void OnPhoneChanged();
partial void OnFaxChanging(string value);
partial void OnFaxChanged();
partial void OnImageChanging(string value);
partial void OnImageChanged();
#endregion
public Customer()
{
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CustomerID",
DbType="NChar(5) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string CustomerID
{
get
{
return this._CustomerID;
}
set
{
if ((this._CustomerID != value))
{
this.OnCustomerIDChanging(value);
this.SendPropertyChanging();
this._CustomerID = value;
this.SendPropertyChanged("CustomerID");
this.OnCustomerIDChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyName",
DbType="NVarChar(40) NOT NULL", CanBeNull=false)]
public string CompanyName
{
get
{
return this._CompanyName;
}
set
{
if ((this._CompanyName != value))
{
this.OnCompanyNameChanging(value);
this.SendPropertyChanging();
this._CompanyName = value;
this.SendPropertyChanged("CompanyName");
this.OnCompanyNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContactName",
DbType="NVarChar(30)")]
public string ContactName
{
get
{
return this._ContactName;
}
set
{
if ((this._ContactName != value))
{
this.OnContactNameChanging(value);
this.SendPropertyChanging();
this._ContactName = value;
this.SendPropertyChanged("ContactName");
this.OnContactNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContactTitle",
DbType="NVarChar(30)")]
public string ContactTitle
{
get
{
return this._ContactTitle;
}
set
{
if ((this._ContactTitle != value))
{
this.OnContactTitleChanging(value);
this.SendPropertyChanging();
this._ContactTitle = value;
this.SendPropertyChanged("ContactTitle");
this.OnContactTitleChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Address",
DbType="NVarChar(60)")]
public string Address
{
get
{
return this._Address;
}
set
{
if ((this._Address != value))
{
this.OnAddressChanging(value);
this.SendPropertyChanging();
this._Address = value;
this.SendPropertyChanged("Address");
this.OnAddressChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_City",
DbType="NVarChar(15)")]
public string City
{
get
{
return this._City;
}
set
{
if ((this._City != value))
{
this.OnCityChanging(value);
this.SendPropertyChanging();
this._City = value;
this.SendPropertyChanged("City");
this.OnCityChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Region",
DbType="NVarChar(15)")]
public string Region
{
get
{
return this._Region;
}
set
{
if ((this._Region != value))
{
this.OnRegionChanging(value);
this.SendPropertyChanging();
this._Region = value;
this.SendPropertyChanged("Region");
this.OnRegionChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PostalCode",
DbType="NVarChar(10)")]
public string PostalCode
{
get
{
return this._PostalCode;
}
set
{
if ((this._PostalCode != value))
{
this.OnPostalCodeChanging(value);
this.SendPropertyChanging();
this._PostalCode = value;
this.SendPropertyChanged("PostalCode");
this.OnPostalCodeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Country",
DbType="NVarChar(15)")]
public string Country
{
get
{
return this._Country;
}
set
{
if ((this._Country != value))
{
this.OnCountryChanging(value);
this.SendPropertyChanging();
this._Country = value;
this.SendPropertyChanged("Country");
this.OnCountryChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Phone",
DbType="NVarChar(24)")]
public string Phone
{
get
{
return this._Phone;
}
set
{
if ((this._Phone != value))
{
this.OnPhoneChanging(value);
this.SendPropertyChanging();
this._Phone = value;
this.SendPropertyChanged("Phone");
this.OnPhoneChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Fax",
DbType="NVarChar(24)")]
public string Fax
{
get
{
return this._Fax;
}
set
{
if ((this._Fax != value))
{
this.OnFaxChanging(value);
this.SendPropertyChanging();
this._Fax = value;
this.SendPropertyChanged("Fax");
this.OnFaxChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Image",
DbType="NVarChar(50)")]
public string Image
{
get
{
return this._Image;
}
set
{
if ((this._Image != value))
{
this.OnImageChanging(value);
this.SendPropertyChanging();
this._Image = value;
this.SendPropertyChanged("Image");
this.OnImageChanged();
}
}
}
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));
}
}
}
}
#pragma warning restore 1591
[DataObjectMethod(DataObjectMethodType.Select, true)]
[DataObjectMethod(DataObjectMethodType.Insert, true)]
[DataObjectMethod(DataObjectMethodType.Update, true)]
[DataObjectMethod(DataObjectMethodType.Delete, true)]
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>