Click here to Skip to main content
11,581,081 members (62,006 online)
Click here to Skip to main content
Add your own
alternative version

A Silverlight Introduction for Line-of-Business Applications

, 30 Aug 2009 CPOL 34.6K 596 58
An introduction on Silverlight for developers of administrative applications. The article starts by explaining the basics of WPF and then delves deeper in the business-oriented aspects.
silverlightlob_src.zip
CarSelector
CarSelector.csproj.user
Img
exit16.png
open16.png
Properties
Service References
CarService
CarSelector.CarService.Car.datasource
CarSelector.CarService.SimpleCar.datasource
CarService.disco
CarService.wsdl
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
ServiceReferences.ClientConfig
Themes
CarSelector.Web
App_Data
CarSelector.Web.csproj.user
CarService.svc
ClientBin
CarSelector.xap
Media
DBDataClasses.dbml
DBDataClasses.dbml.layout
Properties
Settings.settings
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3074
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace CarSelector.Web
{
	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;
	
	
	[System.Data.Linq.Mapping.DatabaseAttribute(Name="CARSDB")]
	public partial class DBDataClassesDataContext : System.Data.Linq.DataContext
	{
		
		private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
		
    #region Extensibility Method Definitions
    partial void OnCreated();
    partial void InsertCar(Car instance);
    partial void UpdateCar(Car instance);
    partial void DeleteCar(Car instance);
    #endregion
		
		public DBDataClassesDataContext() : 
				base(global::CarSelector.Web.Properties.Settings.Default.carconn, mappingSource)
		{
			OnCreated();
		}
		
		public DBDataClassesDataContext(string connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public DBDataClassesDataContext(System.Data.IDbConnection connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public DBDataClassesDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public DBDataClassesDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public System.Data.Linq.Table<Car> Cars
		{
			get
			{
				return this.GetTable<Car>();
			}
		}
	}
	
	[Table(Name="cars")]
	public partial class Car : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private string _Make;
		
		private string _Model;
		
		private string _Type;
		
		private byte[] _Picture;
		
		private int _Doors;
		
		private int _Gears;
		
		private int _Id;
		
		private string _CO2;
		
		private int _Weight;
		
		private decimal _Price;
		
		private System.Data.Linq.Binary _Version;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnMakeChanging(string value);
    partial void OnMakeChanged();
    partial void OnModelChanging(string value);
    partial void OnModelChanged();
    partial void OnTypeChanging(string value);
    partial void OnTypeChanged();
    partial void OnPictureChanging(byte[] value);
    partial void OnPictureChanged();
    partial void OnDoorsChanging(int value);
    partial void OnDoorsChanged();
    partial void OnGearsChanging(int value);
    partial void OnGearsChanged();
    partial void OnIdChanging(int value);
    partial void OnIdChanged();
    partial void OnCO2Changing(string value);
    partial void OnCO2Changed();
    partial void OnWeightChanging(int value);
    partial void OnWeightChanged();
    partial void OnPriceChanging(decimal value);
    partial void OnPriceChanged();
    partial void OnVersionChanging(System.Data.Linq.Binary value);
    partial void OnVersionChanged();
    #endregion
		
		public Car()
		{
			OnCreated();
		}
		
		[Column(Name="make", Storage="_Make", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
		public string Make
		{
			get
			{
				return this._Make;
			}
			set
			{
				if ((this._Make != value))
				{
					this.OnMakeChanging(value);
					this.SendPropertyChanging();
					this._Make = value;
					this.SendPropertyChanged("Make");
					this.OnMakeChanged();
				}
			}
		}
		
		[Column(Name="model", Storage="_Model", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
		public string Model
		{
			get
			{
				return this._Model;
			}
			set
			{
				if ((this._Model != value))
				{
					this.OnModelChanging(value);
					this.SendPropertyChanging();
					this._Model = value;
					this.SendPropertyChanged("Model");
					this.OnModelChanged();
				}
			}
		}
		
		[Column(Name="type", Storage="_Type", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
		public string Type
		{
			get
			{
				return this._Type;
			}
			set
			{
				if ((this._Type != value))
				{
					this.OnTypeChanging(value);
					this.SendPropertyChanging();
					this._Type = value;
					this.SendPropertyChanged("Type");
					this.OnTypeChanged();
				}
			}
		}
		
		[Column(Name="picture", Storage="_Picture", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
		public byte[] Picture
		{
			get
			{
				return this._Picture;
			}
			set
			{
				if ((this._Picture != value))
				{
					this.OnPictureChanging(value);
					this.SendPropertyChanging();
					this._Picture = value;
					this.SendPropertyChanged("Picture");
					this.OnPictureChanged();
				}
			}
		}
		
		[Column(Name="doors", Storage="_Doors", UpdateCheck=UpdateCheck.Never)]
		public int Doors
		{
			get
			{
				return this._Doors;
			}
			set
			{
				if ((this._Doors != value))
				{
					this.OnDoorsChanging(value);
					this.SendPropertyChanging();
					this._Doors = value;
					this.SendPropertyChanged("Doors");
					this.OnDoorsChanged();
				}
			}
		}
		
		[Column(Name="gears", Storage="_Gears", UpdateCheck=UpdateCheck.Never)]
		public int Gears
		{
			get
			{
				return this._Gears;
			}
			set
			{
				if ((this._Gears != value))
				{
					this.OnGearsChanging(value);
					this.SendPropertyChanging();
					this._Gears = value;
					this.SendPropertyChanged("Gears");
					this.OnGearsChanged();
				}
			}
		}
		
		[Column(Name="id", Storage="_Id", AutoSync=AutoSync.OnInsert, IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
		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();
				}
			}
		}
		
		[Column(Storage="_CO2", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
		public string CO2
		{
			get
			{
				return this._CO2;
			}
			set
			{
				if ((this._CO2 != value))
				{
					this.OnCO2Changing(value);
					this.SendPropertyChanging();
					this._CO2 = value;
					this.SendPropertyChanged("CO2");
					this.OnCO2Changed();
				}
			}
		}
		
		[Column(Storage="_Weight", UpdateCheck=UpdateCheck.Never)]
		public int Weight
		{
			get
			{
				return this._Weight;
			}
			set
			{
				if ((this._Weight != value))
				{
					this.OnWeightChanging(value);
					this.SendPropertyChanging();
					this._Weight = value;
					this.SendPropertyChanged("Weight");
					this.OnWeightChanged();
				}
			}
		}
		
		[Column(Name="price", Storage="_Price", UpdateCheck=UpdateCheck.Never)]
		public decimal Price
		{
			get
			{
				return this._Price;
			}
			set
			{
				if ((this._Price != value))
				{
					this.OnPriceChanging(value);
					this.SendPropertyChanging();
					this._Price = value;
					this.SendPropertyChanged("Price");
					this.OnPriceChanged();
				}
			}
		}
		
		[Column(Storage="_Version", DbType="rowversion", IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]
		public System.Data.Linq.Binary Version
		{
			get
			{
				return this._Version;
			}
			set
			{
				if ((this._Version != value))
				{
					this.OnVersionChanging(value);
					this.SendPropertyChanging();
					this._Version = value;
					this.SendPropertyChanged("Version");
					this.OnVersionChanged();
				}
			}
		}
		
		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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Xavier Spileers
CEO TRI-S bvba, Cogenius bvba
Belgium Belgium
I'm working since 1999 in an IT environment: started developing in PROGRESS 4GL, then VB6 and am working since 2003 with C#. I'm currently transitioning to HTML5, CSS3 and JavaScript for the front-end development.
I started my own company (TRI-S) in 2007 and co-founded another one (Cogenius) in 2012.
Besides being a Microsoft Certified Professional Developer (MCPD) I'm also a Microsoft Certified Trainer (MCT) and am teaching .NET and JavaScript courses.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150603.1 | Last Updated 30 Aug 2009
Article Copyright 2009 by Xavier Spileers
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid