Working with classes and data access logic...
-
I've been doing alot of research but coming up dry on strategies for implementing business rules and data access. Microsoft's patterns and practices documentation suggests seperating the actual data logic from the business class. For example, I have the following class:
Public Class TimeEntry Private _EntryID as Integer Private _StartTime as DateTime Private _EndTime as DateTime ' Methods and properties to work with and expose private members Public Sub Save() ' Save this time entry object depending on the current state of ' the application End Sub End Class
I want to be able to save this class either in a database (when in a connected environment) or to a data cache (xml or binary files). I am using the Data Access Application Block for SQL. However, I need the ability to connect to the database and create and update a TimeEntry object in any of the following ways: 1) Web services (for offsite connection to the database) 2) SQL Client (when onsite and connected to the local resources) 3) Data Caching/XML (when offsite and disconnected from any network) Can anyone suggest books or articles that can introduce this concept? I have been developing primarily thin or rich clients. This is the first time I have looked into a smart client development project so I am having a difficult time grasping these concepts from MSDN. Thanks!
-
I've been doing alot of research but coming up dry on strategies for implementing business rules and data access. Microsoft's patterns and practices documentation suggests seperating the actual data logic from the business class. For example, I have the following class:
Public Class TimeEntry Private _EntryID as Integer Private _StartTime as DateTime Private _EndTime as DateTime ' Methods and properties to work with and expose private members Public Sub Save() ' Save this time entry object depending on the current state of ' the application End Sub End Class
I want to be able to save this class either in a database (when in a connected environment) or to a data cache (xml or binary files). I am using the Data Access Application Block for SQL. However, I need the ability to connect to the database and create and update a TimeEntry object in any of the following ways: 1) Web services (for offsite connection to the database) 2) SQL Client (when onsite and connected to the local resources) 3) Data Caching/XML (when offsite and disconnected from any network) Can anyone suggest books or articles that can introduce this concept? I have been developing primarily thin or rich clients. This is the first time I have looked into a smart client development project so I am having a difficult time grasping these concepts from MSDN. Thanks!
-
Which one of these books would be better for introducing concepts in a simplified way? I've read Expert One-on-One Visual Basic .NET Business Objects[[^](http://Expert One-on-One Visual Basic .NET Business Objects "New Window")], but I quickly got lost in the concepts.
-
Which one of these books would be better for introducing concepts in a simplified way? I've read Expert One-on-One Visual Basic .NET Business Objects[[^](http://Expert One-on-One Visual Basic .NET Business Objects "New Window")], but I quickly got lost in the concepts.
Your specific question was about how to decouple your objects from the method used to persist them (database, web service, etc). This can be achieved in many ways, so I am uncomfortable recommending a specific approach without knowing more about your environment. The books I mentioned (esp. P of EAA) cover the subject in detail, but they are not light reading, so I am not sure that they would help. There are some articles on this site, in the Design and Strategy section that may help. If you can find a good systems architect, that would probably be your best bet.