Last post Oct 14, 2011 04:13 PM by mironagy
Oct 14, 2011 11:08 AM|mironagy|LINK
I always seem to come up with the same question.
I do not have enough experience to know what is the 'norm' to do.
I created a website that has products on it. (This website has a dataset in use).
I now want to create a webservice project to interact with the data used with the website mentioned above. I do not want to re-create the wheel, so I would somehow like to use the 'dataset' created in the website above and all its table adapters?
Is this even possible or what is the norm?
Oct 14, 2011 02:39 PM|atconway|LINK
ADO.NET Datasets are 'OK' to use transporting data across layers and in use of databinding, but I would say the more
current 'norm' at a minimum would be to map those datasets to strongly types lists of objects before moving them around. Another option is to all together get rid of that method of manual data extraction and use an ORM like the Entity Framework. If
you want to incorporate services, then using a WCF service that defines a 'Data Contract' will be returned as a strongly typed object collection to the caller. The following sites give a little information into mapping data from DataSets to Objects using LINQ:
.NET Object Collections Using Generics 101:
How To: Populate a List of Objects from a DataSet Using LINQ:
If you absolutely must use the existing DataSets and table adapters, you could place a facade or layer atop of it and re-expose the data in a more OO approach via a WCF service or class library. This allows code reuse, but allows new callers to work with
strongly typed collections instead of the raw DataSet objects.
Oct 14, 2011 04:13 PM|mironagy|LINK
I will try the first link's example and try to make a proper DAL layer and pass around the list of objects.