| The class clsData contains all methods needed to invoque all the stored procedures (SP) and the declaration of all the variables used by those methods. On the other hand a derived class contains only the initialization of those variables but no declarations. The program that generates the clsData only creates those derived classes filling the initializations automatically. So the next piece of code is generated by a program, not hand-made. For explanation purposes I put here an example. 
public class clsClassificacio : clsData
{
	
	
	
	
	public clsClassificacio(string pCadConnBBDD)
	{
		spINS = "DI_EXP_CLASSIFICACIO_INS";
		spUPD = "DI_EXP_CLASSIFICACIO_UPD";
		spGET = "DI_EXP_CLASSIFICACIO_GET";
		spCOUNT = "DI_EXP_CLASSIFICACIO_COUNT";
		spQUERY = "DI_EXP_CLASSIFICACIO_QUERY";
		spDEL = "DI_EXP_CLASSIFICACIO_DEL";
		HasIdentity = true;
		Identity = "PK_Classificacio";
		TableName = "DI_EXP_CLASSIFICACIO";
		UseCache = false;
		CadConnBBDD = pCadConnBBDD;
		ParamsGET = new clsColumn[7];
		for (int i = 0; i < 7; i++) ParamsGET[i] = new clsColumn();
	#region Llista params GET
		ParamsGET[0].ColName = "PK_Classificacio";
		ParamsGET[0].DB_Type = DBType.tint;
		ParamsGET[0].PK = true;
		ParamsGET[0].Identity = true;
		ParamsGET[0].Nulable = false;
		ParamsGET[1].ColName = "Nom";
		ParamsGET[1].DB_Type = DBType.nvarchar;
		ParamsGET[1].Len = 200;
		ParamsGET[1].Nulable = false;
		ParamsGET[2].ColName = "PK_Arxiu";
		ParamsGET[2].DB_Type = DBType.tint;
		ParamsGET[3].ColName = "Codi_TC";
		ParamsGET[3].DB_Type = DBType.nvarchar;
		ParamsGET[3].Len = 5;
		ParamsGET[3].Nulable = false;
		ParamsGET[4].ColName = "Nivell_Codi";
		ParamsGET[4].DB_Type = DBType.nvarchar;
		ParamsGET[4].Len = 100;
		ParamsGET[4].Nulable = false;
		ParamsGET[5].ColName = "IdPare";
		ParamsGET[5].DB_Type = DBType.tint;
		ParamsGET[5].Nulable = false;
		ParamsGET[6].ColName = "FK_TAAD";
		ParamsGET[6].DB_Type = DBType.tint;
	#endregion
		ParamsINS = new clsColumn[10];
		for (int i = 0; i < 10; i++) ParamsINS[i] = new clsColumn();
	#region Llista params INS
		ParamsINS[0].ColName = "PK_Classificacio";
		ParamsINS[0].DB_Type = DBType.tint;
		ParamsINS[0].PK = true;
		ParamsINS[0].Identity = true;
		ParamsINS[0].Nulable = false;
		ParamsINS[1].ColName = "Codi_TC";
		ParamsINS[1].DB_Type = DBType.varchar;
		ParamsINS[1].Len = 5;
		ParamsINS[1].Nulable = false;
		ParamsINS[2].ColName = "Observacions";
		ParamsINS[2].DB_Type = DBType.varchar;
		ParamsINS[2].Len = 3000;
		ParamsINS[3].ColName = "DataAlta";
		ParamsINS[3].DB_Type = DBType.datetime;
		ParamsINS[4].ColName = "DataBaixa";
		ParamsINS[4].DB_Type = DBType.datetime;
		ParamsINS[5].ColName = "Any_inici";
		ParamsINS[5].DB_Type = DBType.tint;
		ParamsINS[5].Nulable = false;
		ParamsINS[6].ColName = "Any_final";
		ParamsINS[6].DB_Type = DBType.tint;
		ParamsINS[6].Nulable = false;
		ParamsINS[7].ColName = "IdPare";
		ParamsINS[7].DB_Type = DBType.tint;
		ParamsINS[7].Nulable = false;
		ParamsINS[8].ColName = "Nom";
		ParamsINS[8].DB_Type = DBType.nvarchar;
		ParamsINS[8].Len = 200;
		ParamsINS[8].Nulable = false;
		ParamsINS[9].ColName = "Nivell_Codi";
		ParamsINS[9].DB_Type = DBType.varchar;
		ParamsINS[9].Len = 100;
		ParamsINS[9].Nulable = false;
	#endregion
		ParamsUPD = new clsColumn[10];
		for (int i = 0; i < 10; i++) ParamsUPD[i] = new clsColumn();
	#region Llista params UPD
		ParamsUPD[0].ColName = "PK_Classificacio";
		ParamsUPD[0].DB_Type = DBType.tint;
		ParamsUPD[0].PK = true;
		ParamsUPD[0].Identity = true;
		ParamsUPD[0].Nulable = false;
		ParamsUPD[1].ColName = "Codi_TC";
		ParamsUPD[1].DB_Type = DBType.varchar;
		ParamsUPD[1].Len = 5;
		ParamsUPD[1].Nulable = false;
		ParamsUPD[2].ColName = "Observacions";
		ParamsUPD[2].DB_Type = DBType.varchar;
		ParamsUPD[2].Len = 3000;
		ParamsUPD[3].ColName = "DataAlta";
		ParamsUPD[3].DB_Type = DBType.datetime;
		ParamsUPD[4].ColName = "DataBaixa";
		ParamsUPD[4].DB_Type = DBType.datetime;
		ParamsUPD[5].ColName = "Any_inici";
		ParamsUPD[5].DB_Type = DBType.tint;
		ParamsUPD[5].Nulable = false;
		ParamsUPD[6].ColName = "Any_final";
		ParamsUPD[6].DB_Type = DBType.tint;
		ParamsUPD[6].Nulable = false;
		ParamsUPD[7].ColName = "IdPare";
		ParamsUPD[7].DB_Type = DBType.tint;
		ParamsUPD[7].Nulable = false;
		ParamsUPD[8].ColName = "Nom";
		ParamsUPD[8].DB_Type = DBType.nvarchar;
		ParamsUPD[8].Len = 200;
		ParamsUPD[8].Nulable = false;
		ParamsUPD[9].ColName = "Nivell_Codi";
		ParamsUPD[9].DB_Type = DBType.varchar;
		ParamsUPD[9].Len = 100;
		ParamsUPD[9].Nulable = false;
	#endregion
		ParamsDEL = new clsColumn[7];
		for (int i = 0; i < 7; i++) ParamsDEL[i] = new clsColumn();
	#region Llista params DEL
		ParamsDEL[0].ColName = "PK_Classificacio";
		ParamsDEL[0].DB_Type = DBType.tint;
		ParamsDEL[0].PK = true;
		ParamsDEL[0].Identity = true;
		ParamsDEL[0].Nulable = false;
		ParamsDEL[1].ColName = "Nom";
		ParamsDEL[1].DB_Type = DBType.nvarchar;
		ParamsDEL[1].Len = 200;
		ParamsDEL[1].Nulable = false;
		ParamsDEL[2].ColName = "PK_Arxiu";
		ParamsDEL[2].DB_Type = DBType.tint;
		ParamsDEL[3].ColName = "Codi_TC";
		ParamsDEL[3].DB_Type = DBType.nvarchar;
		ParamsDEL[3].Len = 5;
		ParamsDEL[3].Nulable = false;
		ParamsDEL[4].ColName = "Nivell_Codi";
		ParamsDEL[4].DB_Type = DBType.nvarchar;
		ParamsDEL[4].Len = 100;
		ParamsDEL[4].Nulable = false;
		ParamsDEL[5].ColName = "IdPare";
		ParamsDEL[5].DB_Type = DBType.tint;
		ParamsDEL[5].Nulable = false;
		ParamsDEL[6].ColName = "FK_TAAD";
		ParamsDEL[6].DB_Type = DBType.tint;
	#endregion
		ParamsQUERY = new clsColumn[7];
		for (int i = 0; i < 7; i++) ParamsQUERY[i] = new clsColumn();
	#region Llista params QUERY
		ParamsQUERY[0].ColName = "PK_Classificacio";
		ParamsQUERY[0].DB_Type = DBType.tint;
		ParamsQUERY[0].PK = true;
		ParamsQUERY[0].Identity = true;
		ParamsQUERY[0].Nulable = false;
		ParamsQUERY[1].ColName = "Nom";
		ParamsQUERY[1].DB_Type = DBType.nvarchar;
		ParamsQUERY[1].Len = 200;
		ParamsQUERY[1].Nulable = false;
		ParamsQUERY[2].ColName = "PK_Arxiu";
		ParamsQUERY[2].DB_Type = DBType.tint;
		ParamsQUERY[3].ColName = "Codi_TC";
		ParamsQUERY[3].DB_Type = DBType.nvarchar;
		ParamsQUERY[3].Len = 5;
		ParamsQUERY[3].Nulable = false;
		ParamsQUERY[4].ColName = "Nivell_Codi";
		ParamsQUERY[4].DB_Type = DBType.nvarchar;
		ParamsQUERY[4].Len = 100;
		ParamsQUERY[4].Nulable = false;
		ParamsQUERY[5].ColName = "IdPare";
		ParamsQUERY[5].DB_Type = DBType.tint;
		ParamsQUERY[5].Nulable = false;
		ParamsQUERY[6].ColName = "FK_TAAD";
		ParamsQUERY[6].DB_Type = DBType.tint;
	#endregion
		ResultColumns = new clsColumn[10];
		for (int i = 0; i < 10; i++) ResultColumns[i] = new clsColumn();
	#region Result columns
		ResultColumns[0].ColName = "PK_Classificacio";
		ResultColumns[0].DB_Type = DBType.tint;
		ResultColumns[0].PK = true;
		ResultColumns[0].Identity = true;
		ResultColumns[0].Nulable = false;
		ResultColumns[1].ColName = "Codi_TC";
		ResultColumns[1].DB_Type = DBType.varchar;
		ResultColumns[1].Len = 5;
		ResultColumns[1].Nulable = false;
		ResultColumns[2].ColName = "Observacions";
		ResultColumns[2].DB_Type = DBType.varchar;
		ResultColumns[2].Len = 3000;
		ResultColumns[3].ColName = "DataAlta";
		ResultColumns[3].DB_Type = DBType.datetime;
		ResultColumns[4].ColName = "DataBaixa";
		ResultColumns[4].DB_Type = DBType.datetime;
		ResultColumns[5].ColName = "Any_inici";
		ResultColumns[5].DB_Type = DBType.tint;
		ResultColumns[5].Nulable = false;
		ResultColumns[6].ColName = "Any_final";
		ResultColumns[6].DB_Type = DBType.tint;
		ResultColumns[6].Nulable = false;
		ResultColumns[7].ColName = "IdPare";
		ResultColumns[7].DB_Type = DBType.tint;
		ResultColumns[7].Nulable = false;
		ResultColumns[8].ColName = "Nom";
		ResultColumns[8].DB_Type = DBType.nvarchar;
		ResultColumns[8].Len = 200;
		ResultColumns[8].Nulable = false;
		ResultColumns[9].ColName = "Nivell_Codi";
		ResultColumns[9].DB_Type = DBType.varchar;
		ResultColumns[9].Len = 100;
		ResultColumns[9].Nulable = false;
	#endregion
		Serialitzar = new clsColumn[10];
		for (int i = 0; i < 10; i++) Serialitzar[i] = new clsColumn();
	#region Serializable columns
		Serialitzar[0].ColName = "PK_Classificacio";
		Serialitzar[0].DB_Type = DBType.tint;
		Serialitzar[1].ColName = "Codi_TC";
		Serialitzar[1].DB_Type = DBType.varchar;
		Serialitzar[1].Len = 5;
		Serialitzar[2].ColName = "Observacions";
		Serialitzar[2].DB_Type = DBType.varchar;
		Serialitzar[2].Len = 3000;
		Serialitzar[3].ColName = "DataAlta";
		Serialitzar[3].DB_Type = DBType.datetime;
		Serialitzar[4].ColName = "DataBaixa";
		Serialitzar[4].DB_Type = DBType.datetime;
		Serialitzar[5].ColName = "Any_inici";
		Serialitzar[5].DB_Type = DBType.tint;
		Serialitzar[6].ColName = "Any_final";
		Serialitzar[6].DB_Type = DBType.tint;
		Serialitzar[7].ColName = "IdPare";
		Serialitzar[7].DB_Type = DBType.tint;
		Serialitzar[8].ColName = "Nom";
		Serialitzar[8].DB_Type = DBType.nvarchar;
		Serialitzar[8].Len = 200;
		Serialitzar[9].ColName = "Nivell_Codi";
		Serialitzar[9].DB_Type = DBType.varchar;
		Serialitzar[9].Len = 100;
	#endregion
		Deserialitzar = new clsColumn[9];
		for (int i = 0; i < 9; i++) Deserialitzar[i] = new clsColumn();
	#region Deserializable columns
		Deserialitzar[0].ColName = "Codi_TC";
		Deserialitzar[0].DB_Type = DBType.varchar;
		Deserialitzar[0].Len = 5;
		Deserialitzar[1].ColName = "Observacions";
		Deserialitzar[1].DB_Type = DBType.varchar;
		Deserialitzar[1].Len = 3000;
		Deserialitzar[2].ColName = "DataAlta";
		Deserialitzar[2].DB_Type = DBType.datetime;
		Deserialitzar[3].ColName = "DataBaixa";
		Deserialitzar[3].DB_Type = DBType.datetime;
		Deserialitzar[4].ColName = "Any_inici";
		Deserialitzar[4].DB_Type = DBType.tint;
		Deserialitzar[5].ColName = "Any_final";
		Deserialitzar[5].DB_Type = DBType.tint;
		Deserialitzar[6].ColName = "IdPare";
		Deserialitzar[6].DB_Type = DBType.tint;
		Deserialitzar[7].ColName = "Nom";
		Deserialitzar[7].DB_Type = DBType.nvarchar;
		Deserialitzar[7].Len = 200;
		Deserialitzar[8].ColName = "Nivell_Codi";
		Deserialitzar[8].DB_Type = DBType.varchar;
		Deserialitzar[8].Len = 100;
	#endregion
	}
}
 Writing all this code by hand is error prone and very boring (a lethal task), that's the reason why a program generates it. SP parameters are obtained from the meta information of the SP that is stored in the database, but this means that the SPs must be in place when this class is generated. The other parameters are obtained from the user interface of the generator software. If a column is checked to serialize then it will appear in the list "Serialitzar", and so on. From this example one can see that the database access layer is formed by the clsData and a ton of derived classes (one for each table). |