Information générale
Catégorie:
Code, syntaxe and commandes
>I have created a class called DataAccess. It's in its own project in the solution. It contains a static reference to my SqlDataAccess class. Right now I have a method in it called GetCompanies() that returns a dataset containing one or more companies.
>
>In the GetCompanies method I was considering populating a generic list containing instances of the Company class and returning that to the UI layer, instead of returning a dataset.
>
>Anyone think there's any benefit to this? Pro's Cons?
Hi,
I guess it depends on what you will be doing with this in the UI. My intuition would say have the SQLDataAccess class return a Dataset to the DataAccess layer but have methods there that either simply pass on the Dataset or convert to different representations (e.g the list of Complany classes) as required.
I'm working with the EF so everything I get from the DB is already an object by the time I get my hands on it so......
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement