View Complete Post
I know what Singleton Pattern means and Abstract class means.
What I wanted to know was how would this apply to real world.
Could anyone give me any good example or simple explanation.
Say I have a simple website, why would I use any of the above if any.
Why would it simplify my architechture.
Thanks in advace.
In this article we explain just how simple it can be to build a WPF application the right way using the MVVM Pattern.
MSDN Magazine February 2009
Service-oriented architecture is a great framework when you need to perform distributed computing tasks over the Internet. But when you want to perform processing inside your local network, a different solution may provide a better fit. That solution, based on the Command pattern, uses Windows services and Microsoft Message Queuing to implement a queued system that meets your needs better than a service-oriented solution. This article explains how to build it.
MSDN Magazine September 2004
MSDN Magazine December 2003
I am working on an application which contains code in lot of places where certain objects are created based on certain condition. The code is something like the following:
if(affectedObject == "Customer")
Customer c = new Customer();
else if(affectedObject == "Salesman")
SalesMan s = new SalesMan();
// Do some processing.
// Do another processing.
I have gone through design patterns once but I am not able to figure out how I can use a pattern to replace my code.
Can any one please help me with this? Any practical code sample would be of great help (code without refactoring and refactored code) so that I can understand it better.
Thanks in advance.
earlier today i was readind about singleton pattern
now i m trying to implement in a testing project
which is like -
public class prodcuttable
private static prodcuttable _instance = new prodcuttable();
public static prodcuttable Instance()
public DataTable loadtable()
DataTable dt = new DataTable();
DataColumn dc = new DataColumn();
dc.ColumnName = "ID";
dc.DataType = Type.GetType("System.Int32");
dc.ColumnName = "Name";
dc.DataType = Type.GetType("System.String");
DataRow dr = dt.NewRow();
dr["ID"] = 1;
dr["Name"] = "Aftab";
//throw new NotImplementedException();
but when i m trying to implement in my Default page
binding with gridview
GridView1.DataSource = prodcuttable.Instance();
its giving me error
The type initializer for 'prodcuttable
I am creating an authentication service. This service has one of the methods to validate username and password and return a status based on it.
The validation method has bunch of things to check before it can say user is valid. This method has a pseudo code similar to this:
If UserName and Password is correct
If User Account is Locked (due to invalid attempts)
If User Account Lockout Period has expired
Log user login status to history table
return User Logged In
return User Account Locked
Insert invalid attempt to login history table
if user has exceeded maximum invalid attemtpts
Lock the user account
return invalid user