I am using PetaPoco. While PetaPoco manages separation of UI with the DAL, I am often confused with the code associated with a server control.
I want to keep loose coupling and don't want code to be tightly integrated with the UI. For instance,
I have a GridView control on my WebForm. The GridView control has Button Fields. When a button associated with a row is clicked, a Command is raised and this code is executed:
I don't think it's too tightly integrated with UI in the RowCommand event。Because you have to have some codes that fetch values from the GridViewRow.Cell's value and pass them as parameters into the method that executes CRUD。
In my mind,the defination of "too tightly integrated with UI" is——You've written from connection to CRUD to UI,no any methods or DLL files at all。
rpk2006
Member
631 Points
631 Posts
Where to keep GridView RowCommand code when using micro-ORM?
Mar 02, 2012 05:02 AM|LINK
I am using PetaPoco. While PetaPoco manages separation of UI with the DAL, I am often confused with the code associated with a server control.
I want to keep loose coupling and don't want code to be tightly integrated with the UI. For instance,
I have a GridView control on my WebForm. The GridView control has Button Fields. When a button associated with a row is clicked, a Command is raised and this code is executed:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "GetSelectedRowDetails") { int currentRowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = GridView1.Rows[currentRowIndex]; TableCell recordID = selectedRow.Cells[2]; string RecordID = recordID.Text; reuse reuse = new reuse(); reuse.CustomClientMessage(RecordID, this.Page); } }Here again I wonder whether the code is tightly coupled or loose. I want to know where should I put this code. How to bind events to a class?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Where to keep GridView RowCommand code when using micro-ORM?
Mar 04, 2012 12:37 AM|LINK
Hello rpk2006:)
I don't think it's too tightly integrated with UI in the RowCommand event。Because you have to have some codes that fetch values from the GridViewRow.Cell's value and pass them as parameters into the method that executes CRUD。
In my mind,the defination of "too tightly integrated with UI" is——You've written from connection to CRUD to UI,no any methods or DLL files at all。