- Get your data
- Do work with your data
- Commit changes to your data
With this basic application structure you can now separate the pulling and processing of the data. You are in complete control of that data being used by the processing code and can manipulated it as you see fit. It is the ideal structure for unit testable code.
public class MyMainWorker
{
public void RunWorker()
{
// Optional begin your transaction here
DataSet ds = GetData();
object o = Execute(ds);
// Begin your transaction
SaveData(ds);
// Commit your transaction
}
private void SaveData(DataSet ds)
{
throw new NotImplementedException();
}
private object Execute(DataSet ds)
{
throw new NotImplementedException();
}
private DataSet GetData()
{
throw new NotImplementedException();
}
}
{
public void RunWorker()
{
// Optional begin your transaction here
DataSet ds = GetData();
object o = Execute(ds);
// Begin your transaction
SaveData(ds);
// Commit your transaction
}
private void SaveData(DataSet ds)
{
throw new NotImplementedException();
}
private object Execute(DataSet ds)
{
throw new NotImplementedException();
}
private DataSet GetData()
{
throw new NotImplementedException();
}
}
Bài viết rất hay cảm ơn bạn đã chia sẻ!
ReplyDeleteCho thuê chung cư season avenue
Cho thuê chung cư discovery complex
Cho thuê chung cư udic complex
Cho thuê chung cư golden palace