Click here to Skip to main content
15,905,587 members
Home / Discussions / C#
   

C#

 
GeneralRe: can i capture the double click event of a CELL in a windows datagrd? Pin
robmays16-Jun-04 9:27
robmays16-Jun-04 9:27 
GeneralRe: can i capture the double click event of a CELL in a windows datagrd? Pin
robmays16-Jun-04 10:59
robmays16-Jun-04 10:59 
GeneralDesign Question Pin
matthias s.16-Jun-04 5:35
matthias s.16-Jun-04 5:35 
GeneralRe: Design Question Pin
Colin Angus Mackay16-Jun-04 5:42
Colin Angus Mackay16-Jun-04 5:42 
GeneralRe: Design Question Pin
matthias s.16-Jun-04 5:49
matthias s.16-Jun-04 5:49 
GeneralRe: Design Question Pin
Colin Angus Mackay16-Jun-04 6:07
Colin Angus Mackay16-Jun-04 6:07 
GeneralRe: Design Question Pin
matthias s.16-Jun-04 6:22
matthias s.16-Jun-04 6:22 
GeneralRe: Design Question Pin
Steven Campbell16-Jun-04 6:18
Steven Campbell16-Jun-04 6:18 
First off, congratulations on your noble goals.

In the past, I have typically created what I think of as "heavy" business objects, which contain the queries used to persist them, properties that can be used to get related objects, validation, etc. I have found this design to be inflexible, and the objects can become overly complex. Better is to separate these into multiple classes, and let each one be simple, and do what it does well. (This also makes them easy to write).

For example, in my more recent projects, I have taken to splitting each business object into 2 separate parts. The first is for persisting and retrieving data, and does the object-relational db mapping. The second contains object properties, and not much else. Validation is coded outside of these objects, so as to be re-usable at different levels.

Thus, I might have 2 classes, Business.Customer and Data.Customer. To retrieve a customer from the database, I say something like MyCustomer = Data.Customer.GetById(customerId).

If I want to retrieve the address of the Customer, I say MyCustomerAddress = Data.Address.GetById(MyCustomer.AddressId) (whereas before, I would say MyCustomerAddress = MyCustomer.Address)). The old technique was a false economy, primarily because it created inflexibility while adding very little (I can still do it in a single line of code).

This works out great for me, and here's the clincher - the classes are all generated from the database, using a tool called CodeSmith. Once they are generated, I tweak them as needed. Mostly, I can then concentrate on the coding of my actual application, without worrying about SQL, etc.

IMO, "business" object design should be no harder than database design. Bang those together (preferably using tools), and then you can concentrate on the more challenging pieces, such as security, validation, and your controlling logic.
GeneralRe: Design Question Pin
Serge Lobko-Lobanovsky16-Jun-04 6:26
Serge Lobko-Lobanovsky16-Jun-04 6:26 
GeneralRe: Design Question Pin
Colin Angus Mackay16-Jun-04 6:31
Colin Angus Mackay16-Jun-04 6:31 
Generalpreserving same type information Pin
avneeshb16-Jun-04 5:19
avneeshb16-Jun-04 5:19 
GeneralRe: preserving same type information Pin
Serge Lobko-Lobanovsky16-Jun-04 6:54
Serge Lobko-Lobanovsky16-Jun-04 6:54 
GeneralRe: preserving same type information Pin
avneeshb16-Jun-04 8:50
avneeshb16-Jun-04 8:50 
GeneralProject references! Pin
goldoche16-Jun-04 5:15
goldoche16-Jun-04 5:15 
GeneralRe: Project references! Pin
goldoche16-Jun-04 5:37
goldoche16-Jun-04 5:37 
GeneralCustom control Pin
liko16-Jun-04 5:15
liko16-Jun-04 5:15 
GeneralRe: Custom control Pin
Stefan Troschuetz16-Jun-04 5:24
Stefan Troschuetz16-Jun-04 5:24 
GeneralRe: Custom control Pin
liko16-Jun-04 23:24
liko16-Jun-04 23:24 
GeneralRe: Custom control Pin
Stefan Troschuetz16-Jun-04 23:42
Stefan Troschuetz16-Jun-04 23:42 
GeneralRe: Custom control Pin
liko17-Jun-04 4:55
liko17-Jun-04 4:55 
GeneralRe: Design Question Pin
Colin Angus Mackay16-Jun-04 5:15
Colin Angus Mackay16-Jun-04 5:15 
GeneralRe: Design Question Pin
Dave Kreskowiak16-Jun-04 5:27
mveDave Kreskowiak16-Jun-04 5:27 
GeneralFlicker Free RichTextBox Pin
Peter Vertes16-Jun-04 4:32
Peter Vertes16-Jun-04 4:32 
GeneralRe: Flicker Free RichTextBox Pin
Stefan Troschuetz16-Jun-04 5:04
Stefan Troschuetz16-Jun-04 5:04 
GeneralRe: Flicker Free RichTextBox Pin
leppie16-Jun-04 7:06
leppie16-Jun-04 7:06 

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.