5 people following this project (follow)

dV2t Enterprise Library: Data, Cache, Security, Utilities, ...
Use .NET Framework 2.0 or lates

Example:

public EmployeeInfo GetById(dV2t.Data.Database db, int Id)
{
	db.NewDbCommand("GetEmployee", System.Data.CommandType.Text, "SELECT * FROM EMPLOYEES WHERE ID = " + Id);
	EmployeeInfo re = dV2t.Data.Cbo<EmployeeInfo>.FillObject(db.ExecReader("GetEmployee"));
	return re;
}

public List<EmployeeInfo> List(dV2t.Data.Database db)
{
	db.NewDbCommand("ListEmployees", System.Data.CommandType.Text, "SELECT * FROM EMPLOYEES");	
	List<EmployeeInfo> re = dV2t.Data.Cbo<EmployeeInfo>.FillCollections(db.ExecReader("ListEmployees"));
	return re;
}

public Dictionary<int, EmployeeInfo> List(dV2t.Data.Database db)
{
	db.NewDbCommand("ListEmployees", System.Data.CommandType.Text, "SELECT * FROM EMPLOYEES");
	Dictionary<int, EmployeeInfo> re = 
                dV2t.Data.Cbo<int, EmployeeInfo>.FillDictionaryKey(db.ExecReader("ListEmployees"), "EmployeeID");
	return re;
}

public System.Data.DataSet List(dV2t.Data.Database db, string tableName)
{
	db.NewDbCommand("ListEmployees", System.Data.CommandType.Text, "SELECT * FROM EMPLOYEES");
	System.Data.DataSet ds = new System.Data.DataSet();
	dV2t.Data.Cbo.FillDataSet(db, "ListEmployees", ds, tableName);
	return ds;
}

Last edited Aug 22 2010 at 10:06 AM by doanvanvinhtho, version 4