Click here to Skip to main content
15,912,665 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
AnswerRe: What's the deal with various coding practices and "Code Smell" these days?? Pin
Pete O'Hanlon10-Dec-12 8:49
mvePete O'Hanlon10-Dec-12 8:49 
GeneralRe: What's the deal with various coding practices and "Code Smell" these days?? Pin
Robb Ryniak10-Dec-12 10:10
Robb Ryniak10-Dec-12 10:10 
GeneralRe: What's the deal with various coding practices and "Code Smell" these days?? Pin
Pete O'Hanlon10-Dec-12 22:13
mvePete O'Hanlon10-Dec-12 22:13 
GeneralRe: What's the deal with various coding practices and "Code Smell" these days?? Pin
Robb Ryniak11-Dec-12 11:41
Robb Ryniak11-Dec-12 11:41 
Questionexample of well designed softwares Pin
Giuseppe Tollini6-Dec-12 2:56
Giuseppe Tollini6-Dec-12 2:56 
AnswerRe: example of well designed softwares Pin
jschell6-Dec-12 9:17
jschell6-Dec-12 9:17 
AnswerRe: example of well designed softwares Pin
Eddy Vluggen7-Dec-12 2:07
professionalEddy Vluggen7-Dec-12 2:07 
AnswerRe: example of well designed softwares Pin
Keld Ølykke9-Dec-12 9:45
Keld Ølykke9-Dec-12 9:45 
QuestionWeb services theory Pin
Bytescream3-Dec-12 10:24
Bytescream3-Dec-12 10:24 
AnswerRe: Web services theory Pin
Raj Champaneriya3-Dec-12 18:41
professionalRaj Champaneriya3-Dec-12 18:41 
AnswerRe: Web services theory Pin
jschell4-Dec-12 8:17
jschell4-Dec-12 8:17 
QuestionConsuming perl webservice in .Net Pin
ernestohari1-Dec-12 22:38
ernestohari1-Dec-12 22:38 
AnswerRe: Consuming perl webservice in .Net Pin
Eddy Vluggen2-Dec-12 2:57
professionalEddy Vluggen2-Dec-12 2:57 
QuestionThoughts on Authorization in a Hierarchical User Structure. Pin
Brady Kelly1-Dec-12 1:56
Brady Kelly1-Dec-12 1:56 
AnswerRe: Thoughts on Authorization in a Hierarchical User Structure. Pin
Eddy Vluggen2-Dec-12 2:56
professionalEddy Vluggen2-Dec-12 2:56 
GeneralRe: Thoughts on Authorization in a Hierarchical User Structure. Pin
Brady Kelly2-Dec-12 3:06
Brady Kelly2-Dec-12 3:06 
GeneralRe: Thoughts on Authorization in a Hierarchical User Structure. Pin
Eddy Vluggen2-Dec-12 3:34
professionalEddy Vluggen2-Dec-12 3:34 
QuestionA MEF Question - Refering base classes without adding reference to a dll. Pin
John T.Emmatty29-Nov-12 22:25
John T.Emmatty29-Nov-12 22:25 
AnswerRe: A MEF Question - Refering base classes without adding reference to a dll. Pin
Eddy Vluggen1-Dec-12 5:30
professionalEddy Vluggen1-Dec-12 5:30 
QuestionHand Gesture Recognition System Pin
Member 916988728-Nov-12 3:00
Member 916988728-Nov-12 3:00 
AnswerRe: Hand Gesture Recognition System Pin
Eddy Vluggen1-Dec-12 5:27
professionalEddy Vluggen1-Dec-12 5:27 
QuestionMoving code from a Window/UserControl to outside in order to make it reusable! Pin
Praveen Raghuvanshi27-Nov-12 6:48
professionalPraveen Raghuvanshi27-Nov-12 6:48 
AnswerRe: Moving code from a Window/UserControl to outside in order to make it reusable! Pin
Eddy Vluggen1-Dec-12 5:25
professionalEddy Vluggen1-Dec-12 5:25 
Rags1512 wrote:
I wanted to move above methods outside this class, so that they can be used elsewhere in a functionality such as Undo/Redo which will create/delete an employee using AddEmployee/RemoveEmployee methods.

There's usually no undo/redo on the database-level. Check out the Memento-pattern, you'll see that it'd be a bit work to implement correctly.

Rags1512 wrote:
One solution is to move those methods to a helper which i don't feel to be appropiate as I need to pass all the dependencies of AddEmployee() method as a parameter.
Other solution can be to create a separate class to which will perform all the operations and keep the dependencies.

What dependencies? FWIW, I'd put it in a separate class, which would be embedded in the UserControl. Similar to;
C#
class MyControl: UserControl
{
  class MyControlHelper: object
  {
  }
}

Referring from the UC to the helper-class, is like creating a mini-DAL for your control; all IO is situated in that class. The biggest advantage is that you could write another MyControlHelper-implementation (for say, supporting another database like Oracle or Sqlite) and hook it in there.

Which parameters would you be passing? The way I see it, you'd minimal pass an Employee object. Perhaps a ConnectionString, but that'd be it. If you want to prevent writing a long signature (lot's o' params), then wrap them in their own object (like MyControlHelperAddEmployeeArgs).

Hope this gets you a bit in the right direction Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

GeneralRe: Moving code from a Window/UserControl to outside in order to make it reusable! Pin
Praveen Raghuvanshi9-Dec-12 4:46
professionalPraveen Raghuvanshi9-Dec-12 4:46 
Questionhow to show database table in a class diagram Pin
Qobacha24-Nov-12 22:49
Qobacha24-Nov-12 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.