There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Use with webforms load/save typical scenarios
I'll try to simplify the scenario, so, not all the names and practices below are real world or topic for criticism:
Let's say I have EmployeeEntity object, and EditEmployee.aspx page, which has private field _employeeEntity.
In my Page_Load event I might have something like:
_employeeEntity = new EmployeeEntity( Request.QueryString["id"] );
Say I also have a Save button, where the button click is something like:
_employeeEntity.Save(); // or EmployeeRepository.Save(_employeeEntity); .. whatever
Cam Automapper help me with LoadUIFromEmployeeModel() and LoadEmployeeModelFromUI() ?
I mean, where the two functions look like:
txtName.Text = _employeeEntity.Name; //text box
chkIsActive.Checked = _employeeEntity.IsActive; //check box
ddlDepartmentId.Items.SelectByValue(_employeeEntity.DepartmentId); // drop down list
_employeeEntity.Name = txtName.Text; //text box
_employeeEntity.IsActive = chkIsActive.Checked; //check box
_employeeEntity.DepartmentId = ddlDepartmentId.SelectedValue; // drop down list
Can I automate this somehow using Automap?
If yes, what is the sample code of doing it?
Also, if yes, what are the limitations (for example, the drop down list line or say if I have the Name as two text boxes: txtName_FirstName mapping to _employeeEntity.Name.FirstName and txtName_LastName mapping to _employeeEntity.Name.LastName)?