Click here to Skip to main content
15,885,980 members
Home / Discussions / Database
   

Database

 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
Ashfield31-Aug-08 7:09
Ashfield31-Aug-08 7:09 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
bfis1081371-Sep-08 6:39
bfis1081371-Sep-08 6:39 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
Ashfield1-Sep-08 8:43
Ashfield1-Sep-08 8:43 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
bfis1081371-Sep-08 8:47
bfis1081371-Sep-08 8:47 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
Ashfield1-Sep-08 19:52
Ashfield1-Sep-08 19:52 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
liron.levi31-Aug-08 10:15
professionalliron.levi31-Aug-08 10:15 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
bfis1081371-Sep-08 6:37
bfis1081371-Sep-08 6:37 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
liron.levi1-Sep-08 7:15
professionalliron.levi1-Sep-08 7:15 
I'll give you an example from real life.

I have a Customer class that has a list of contact persons inside it. Something like:

public class Customer
{
public List<contactperson> Contacts;
}

This is a simple clean data class, but when you model it in the database you'll end up with two tables (of course this is just my interpretation - you can use different representation but this is a valid one in my case):

CREATE TABLE Customer
(
int CustomerID PRIMARY KEY,
nvarchar(50) FirstName NOT NULL,
nvarchar(50) LastName NOT NULL,

... more fields here
)

CREATE TABLE ContactPersons
(
int CustomerID, -- foreign key to the customer table
nvarchar(50) HomePhone,

.. more fields here
)

When you work with Visual Studio designer it will create a CustomerRow class and a ContactPersonsRow class to represent the rows of these two tables. However - you can forget about having it creating a single class like I showed you above. If you want such a class you'll have to write it yourself (relations will not help in this case).

Another problem is that the visual studio designer writes the autogenerated code around the concept of data sets and data tables. What do you do if you want to build a separate server process and than pass these objects between the client and the server? (you guess - more classes and more mapping code to map from data rows to your pure data classes and vice-versa). One of the tenets of good object oriented design is to separate the data classes from external DB specific interfaces (like ADO.NET) and Microsoft doesn't help at all in this regard.

All in all - the visual studio data designers are probably meant for building quick-n-dirty database solutions and not for providing the infra-structure that you need when building real-world applications. And I say this with a lot of grief because I'm currently stuck with their solution due to a bad decision on my part Frown | :(

I don't even mention that there is no explicit support for retrieving data using both the CustomerTableAdapter class and the ContactTableAdapter class in the same transaction (you have to roll your own solution here because Microsoft did not think that such thing is common enough to warrant having it in their auto generated classes, another gross mistake IMHO).

In the end, you can either break object oriented encapsulation and go with Microsoft in their half-baked solution, use their designer generated code as a middle-ground for building real object oriented support to your data (my fate unfortunately) or use a mapping layer that will relieve you from having to write most of this code yourself (like NHibernate).

Personally I hate all of these solutions. For god sake we are in 2008 and there is no reason why we must use DB technologies from the 60s plus having to break our neck trying to interface with it. The relational DB model and the object oriented models are simply inconsistent with each other and a good, free object oriented database will solve the problem from its root.

In short - use Hibernate or something like it if you can. With regards to DB technology I sometimes feel like I came from the future and nobody knows what I'm talking about Poke tongue | ;-P

Good Luck
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
bfis1081371-Sep-08 7:32
bfis1081371-Sep-08 7:32 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
liron.levi1-Sep-08 7:54
professionalliron.levi1-Sep-08 7:54 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? [modified] Pin
bfis1081372-Sep-08 6:47
bfis1081372-Sep-08 6:47 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
liron.levi3-Sep-08 9:00
professionalliron.levi3-Sep-08 9:00 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
bfis1081374-Sep-08 3:53
bfis1081374-Sep-08 3:53 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
liron.levi4-Sep-08 9:32
professionalliron.levi4-Sep-08 9:32 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
bfis1081374-Sep-08 10:19
bfis1081374-Sep-08 10:19 
GeneralRe: what's your opinion on the Visual Studion 2005 data designer? Pin
liron.levi4-Sep-08 10:41
professionalliron.levi4-Sep-08 10:41 
QuestionFinding a certain character Pin
Ballita28-Aug-08 22:02
Ballita28-Aug-08 22:02 
AnswerRe: Finding a certain character Pin
Manas Bhardwaj28-Aug-08 22:55
professionalManas Bhardwaj28-Aug-08 22:55 
AnswerRe: Finding a certain character Pin
Syed Mehroz Alam28-Aug-08 23:35
Syed Mehroz Alam28-Aug-08 23:35 
QuestionMDX query iif condition Pin
annu0828-Aug-08 20:18
annu0828-Aug-08 20:18 
AnswerRe: MDX query iif condition[Ignore repost] Pin
Manas Bhardwaj28-Aug-08 22:44
professionalManas Bhardwaj28-Aug-08 22:44 
Questioncomparing data in SQL with an XML file [modified] Pin
ONeil Tomlinson28-Aug-08 5:36
ONeil Tomlinson28-Aug-08 5:36 
AnswerRead XML file Pin
David Mujica28-Aug-08 6:34
David Mujica28-Aug-08 6:34 
QuestionSave Image in SQL Database Pin
bapu288928-Aug-08 3:12
bapu288928-Aug-08 3:12 
AnswerRe: Save Image in SQL Database Pin
Wendelius28-Aug-08 4:11
mentorWendelius28-Aug-08 4:11 

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.