Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What kind of problem were you facing? Anyways I have made sample (yet basic) structure of how you can achieve this in WinForm. I have done using sort of Model View Presenter pattern. </p> <p>First of all we have a presenter, which would deal with unit of work almost similarly the way controller does</p> <pre><code>internal class EmployeePresenter { private readonly IEmployeeFormView _employeeFormView; private readonly IUnitOfWork _unitOfWork; public EmployeePresenter(IEmployeeFormView view) { _employeeFormView = view; _unitOfWork = new SqlUnitOfWork(); } internal void GetData() { var id = 1; //parameter var employee = _unitOfWork.Employees.Single(e =&gt; e.Id == id); _employeeFormView.PopulateData(employee.Name); } } </code></pre> <p>Then we have an interface and a form implementing that interface</p> <pre><code>public interface IEmployeeFormView { void PopulateData(string data); } public partial class EmployeeForm : Form, IEmployeeFormView { private readonly EmployeePresenter _presenter; public EmployeeForm() { InitializeComponent(); _presenter = new EmployeePresenter(this); } #region IEmployeeFormView Members public void PopulateData(string data) { txtName.Text = data; //txtName is a textbox on form } #endregion private void btnGet_Click(object sender, EventArgs e) { _presenter.GetData(); } } </code></pre> <p>Add the required reference and you are done. This might not be the best way but it's certainly a way to achieve this.</p> <p>Solution is upload <a href="http://www.box.com/s/cafa9dc1794ebb3811d2" rel="nofollow">here</a>.</p> <p>Hope this helps. Please feel free to discuss, if required.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload