|
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NWind
{
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;
[System.Data.Linq.Mapping.DatabaseAttribute(Name="Northwind")]
public partial class NWindDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
#region Extensibility Method Definitions
partial void OnCreated();
partial void InsertCategory(NWind.Entities.Category instance);
partial void UpdateCategory(NWind.Entities.Category instance);
partial void DeleteCategory(NWind.Entities.Category instance);
partial void InsertProduct(NWind.Entities.Product instance);
partial void UpdateProduct(NWind.Entities.Product instance);
partial void DeleteProduct(NWind.Entities.Product instance);
#endregion
public NWindDataContext() :
base(global::Linq2Sql.Properties.Settings.Default.NorthwindConnectionString, mappingSource)
{
OnCreated();
}
public NWindDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NWindDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NWindDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public NWindDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public System.Data.Linq.Table<NWind.Entities.Category> Categories
{
get
{
return this.GetTable<NWind.Entities.Category>();
}
}
public System.Data.Linq.Table<NWind.Entities.Product> Products
{
get
{
return this.GetTable<NWind.Entities.Product>();
}
}
}
}
namespace NWind.Entities
{
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.ComponentModel;
using System;
[Table(Name="dbo.Categories")]
public partial class Category : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _CategoryID;
private string _CategoryName;
private string _Description;
private System.Data.Linq.Binary _Picture;
private EntitySet<Product> _Products;
#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 OnCategoryNameChanging(string value);
partial void OnCategoryNameChanged();
partial void OnDescriptionChanging(string value);
partial void OnDescriptionChanged();
partial void OnPictureChanging(System.Data.Linq.Binary value);
partial void OnPictureChanged();
#endregion
public Category()
{
this._Products = new EntitySet<Product>(new Action<Product>(this.attach_Products), new Action<Product>(this.detach_Products));
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="_CategoryName", DbType="NVarChar(15) NOT NULL", CanBeNull=false)]
public string CategoryName
{
get
{
return this._CategoryName;
}
set
{
if ((this._CategoryName != value))
{
this.OnCategoryNameChanging(value);
this.SendPropertyChanging();
this._CategoryName = value;
this.SendPropertyChanged("CategoryName");
this.OnCategoryNameChanged();
}
}
}
[Column(Storage="_Description", DbType="NText", UpdateCheck=UpdateCheck.Never)]
public string Description
{
get
{
return this._Description;
}
set
{
if ((this._Description != value))
{
this.OnDescriptionChanging(value);
this.SendPropertyChanging();
this._Description = value;
this.SendPropertyChanged("Description");
this.OnDescriptionChanged();
}
}
}
[Column(Storage="_Picture", DbType="Image", UpdateCheck=UpdateCheck.Never)]
public System.Data.Linq.Binary Picture
{
get
{
return this._Picture;
}
set
{
if ((this._Picture != value))
{
this.OnPictureChanging(value);
this.SendPropertyChanging();
this._Picture = value;
this.SendPropertyChanged("Picture");
this.OnPictureChanged();
}
}
}
[Association(Name="Category_Product", Storage="_Products", ThisKey="CategoryID", OtherKey="CategoryID")]
public EntitySet<Product> Products
{
get
{
return this._Products;
}
set
{
this._Products.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_Products(Product entity)
{
this.SendPropertyChanging();
entity.Category = this;
}
private void detach_Products(Product entity)
{
this.SendPropertyChanging();
entity.Category = null;
}
}
[Table(Name="dbo.Products")]
public partial class Product : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _ProductID;
private string _ProductName;
private System.Nullable<int> _SupplierID;
private System.Nullable<int> _CategoryID;
private string _QuantityPerUnit;
private System.Nullable<decimal> _UnitPrice;
private System.Nullable<short> _UnitsInStock;
private System.Nullable<short> _UnitsOnOrder;
private System.Nullable<short> _ReorderLevel;
private bool _Discontinued;
private EntityRef<Category> _Category;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnProductIDChanging(int value);
partial void OnProductIDChanged();
partial void OnProductNameChanging(string value);
partial void OnProductNameChanged();
partial void OnSupplierIDChanging(System.Nullable<int> value);
partial void OnSupplierIDChanged();
partial void OnCategoryIDChanging(System.Nullable<int> value);
partial void OnCategoryIDChanged();
partial void OnQuantityPerUnitChanging(string value);
partial void OnQuantityPerUnitChanged();
partial void OnUnitPriceChanging(System.Nullable<decimal> value);
partial void OnUnitPriceChanged();
partial void OnUnitsInStockChanging(System.Nullable<short> value);
partial void OnUnitsInStockChanged();
partial void OnUnitsOnOrderChanging(System.Nullable<short> value);
partial void OnUnitsOnOrderChanged();
partial void OnReorderLevelChanging(System.Nullable<short> value);
partial void OnReorderLevelChanged();
partial void OnDiscontinuedChanging(bool value);
partial void OnDiscontinuedChanged();
#endregion
public Product()
{
this._Category = default(EntityRef<Category>);
OnCreated();
}
[Column(Storage="_ProductID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int ProductID
{
get
{
return this._ProductID;
}
set
{
if ((this._ProductID != value))
{
this.OnProductIDChanging(value);
this.SendPropertyChanging();
this._ProductID = value;
this.SendPropertyChanged("ProductID");
this.OnProductIDChanged();
}
}
}
[Column(Storage="_ProductName", DbType="NVarChar(40) NOT NULL", CanBeNull=false)]
public string ProductName
{
get
{
return this._ProductName;
}
set
{
if ((this._ProductName != value))
{
this.OnProductNameChanging(value);
this.SendPropertyChanging();
this._ProductName = value;
this.SendPropertyChanged("ProductName");
this.OnProductNameChanged();
}
}
}
[Column(Storage="_SupplierID", DbType="Int")]
public System.Nullable<int> SupplierID
{
get
{
return this._SupplierID;
}
set
{
if ((this._SupplierID != value))
{
this.OnSupplierIDChanging(value);
this.SendPropertyChanging();
this._SupplierID = value;
this.SendPropertyChanged("SupplierID");
this.OnSupplierIDChanged();
}
}
}
[Column(Storage="_CategoryID", DbType="Int")]
public System.Nullable<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();
}
}
}
[Column(Storage="_QuantityPerUnit", DbType="NVarChar(20)")]
public string QuantityPerUnit
{
get
{
return this._QuantityPerUnit;
}
set
{
if ((this._QuantityPerUnit != value))
{
this.OnQuantityPerUnitChanging(value);
this.SendPropertyChanging();
this._QuantityPerUnit = value;
this.SendPropertyChanged("QuantityPerUnit");
this.OnQuantityPerUnitChanged();
}
}
}
[Column(Storage="_UnitPrice", DbType="Money")]
public System.Nullable<decimal> UnitPrice
{
get
{
return this._UnitPrice;
}
set
{
if ((this._UnitPrice != value))
{
this.OnUnitPriceChanging(value);
this.SendPropertyChanging();
this._UnitPrice = value;
this.SendPropertyChanged("UnitPrice");
this.OnUnitPriceChanged();
}
}
}
[Column(Storage="_UnitsInStock", DbType="SmallInt")]
public System.Nullable<short> UnitsInStock
{
get
{
return this._UnitsInStock;
}
set
{
if ((this._UnitsInStock != value))
{
this.OnUnitsInStockChanging(value);
this.SendPropertyChanging();
this._UnitsInStock = value;
this.SendPropertyChanged("UnitsInStock");
this.OnUnitsInStockChanged();
}
}
}
[Column(Storage="_UnitsOnOrder", DbType="SmallInt")]
public System.Nullable<short> UnitsOnOrder
{
get
{
return this._UnitsOnOrder;
}
set
{
if ((this._UnitsOnOrder != value))
{
this.OnUnitsOnOrderChanging(value);
this.SendPropertyChanging();
this._UnitsOnOrder = value;
this.SendPropertyChanged("UnitsOnOrder");
this.OnUnitsOnOrderChanged();
}
}
}
[Column(Storage="_ReorderLevel", DbType="SmallInt")]
public System.Nullable<short> ReorderLevel
{
get
{
return this._ReorderLevel;
}
set
{
if ((this._ReorderLevel != value))
{
this.OnReorderLevelChanging(value);
this.SendPropertyChanging();
this._ReorderLevel = value;
this.SendPropertyChanged("ReorderLevel");
this.OnReorderLevelChanged();
}
}
}
[Column(Storage="_Discontinued", DbType="Bit NOT NULL")]
public bool Discontinued
{
get
{
return this._Discontinued;
}
set
{
if ((this._Discontinued != value))
{
this.OnDiscontinuedChanging(value);
this.SendPropertyChanging();
this._Discontinued = value;
this.SendPropertyChanged("Discontinued");
this.OnDiscontinuedChanged();
}
}
}
[Association(Name="Category_Product", Storage="_Category", ThisKey="CategoryID", OtherKey="CategoryID", IsForeignKey=true)]
public Category Category
{
get
{
return this._Category.Entity;
}
set
{
Category previousValue = this._Category.Entity;
if (((previousValue != value)
|| (this._Category.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Category.Entity = null;
previousValue.Products.Remove(this);
}
this._Category.Entity = value;
if ((value != null))
{
value.Products.Add(this);
this._CategoryID = value.CategoryID;
}
else
{
this._CategoryID = default(Nullable<int>);
}
this.SendPropertyChanged("Category");
}
}
}
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
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am just as good as I get; Otherwise, I am a Software Professional with years of Software Development Experience and my USP is that I believe in bestowing excellence in the software solutions that are in tune with the user requirements and deliver the excellent results to the clients. I present myself as an innovative professional who utilize the unique blend of technical expertise with business acumen.
Find more information about me here
http://santxiitr.wix.com/santosh