I'm working with tableadapters to access strongly typed datasets in web application. The datasets are stored in a folder inside of the project. I don't want to access the tableadapters directly from the presentation code behind so I decided to a class
to provide a layer of abstraction. I now have web pages for the presention, a class for the business layer, and the datasets for the data access layer. I'm trying to figure out the best way to pass the information that is retrieved from the datasets to
the presentation. I'm not sure if I should create functions in the class that returns a dataset/datatable to the presentation? Or should I create class properties and assign the dataset/datatable row values to each property and return the class itself? Can
someone explain the correct way to return tableadapter data in the modified 3 tier approach mentioned above?
Public Function GetData(ByVal Name as string) as DataSet
' Table adapter call
return DataSet
End Function
Public Property Address as String
Public Function GetData(ByVal Name as string) as ClassName
Member
2 Points
11 Posts
working with tableadapters and classes
Aug 18, 2014 10:00 PM|MrMyagi|LINK
I'm working with tableadapters to access strongly typed datasets in web application. The datasets are stored in a folder inside of the project. I don't want to access the tableadapters directly from the presentation code behind so I decided to a class to provide a layer of abstraction. I now have web pages for the presention, a class for the business layer, and the datasets for the data access layer. I'm trying to figure out the best way to pass the information that is retrieved from the datasets to the presentation. I'm not sure if I should create functions in the class that returns a dataset/datatable to the presentation? Or should I create class properties and assign the dataset/datatable row values to each property and return the class itself? Can someone explain the correct way to return tableadapter data in the modified 3 tier approach mentioned above?
Public Function GetData(ByVal Name as string) as DataSet
' Table adapter call
return DataSet
End Function
Public Property Address as String
Public Function GetData(ByVal Name as string) as ClassName
' Table adapter call
If UserDatatable.row.count > 0
ClassName.Address = UserDatatable.Address
End if
return ClassName
End Function
All-Star
194832 Points
28099 Posts
Moderator
Re: working with tableadapters and classes
Aug 19, 2014 02:19 AM|Mikesdotnetting|LINK
The recommended approach is to create a business logic layer which is referenced by your presentation layer: http://msdn.microsoft.com/en-us/library/aa581780.aspx