views:

28

answers:

1

Where is the Object relational designer and Entity data model designer in Visual studio ? What is the first of them used for ? What is the second used for ?

I have used Entity data model designer one or two times, is the use of Object relational designer different ? How do I reference classes in my Object relational design from code ?

Thank you

+2  A: 

http://msdn.microsoft.com/en-us/library/bb738482(VS.90).aspx
The ADO.NET Entity Data Model Designer (Entity Designer) is a visual tool that enables point-and-click modification of an EDM. You can use the Entity Designer to visually create and modify entities, associations, mappings, and inheritance relationships. You can also validate an EDM.

http://msdn.microsoft.com/en-us/library/bb384429.aspx The Object Relational Designer (O/R Designer) provides a visual design surface for creating LINQ to SQL entity classes and associations (relationships) that are based on objects in a database. In other words, the O/R Designer is used to create an object model in an application that maps to objects in a database. It also generates a strongly-typed DataContext that is used to send and receive data between the entity classes and the database.

The Object Relational Designer is more for creating objects that mimic your database tables in a way that they are easily updateable and easy to query from. (LINQ to SQL)

The Entity Data Model Designer is used to manage the relationships, etc within the database.

To Use either of these In the "Add new item" window Select "Data" then either "ADO.NET Entity Data Model" or "LINQ to SQL Classes"
alt text

To use the Object Relational Designer simply open the server explorer and drag a table into the data class window. It should show the table name with the properties. Now in your code simply type that table name as if it were an object.
alt text

Gage
Thank you. For what would you recommend Object Relational Designer? For what would you recommend Entity Data Model Designer?
drasto
I think it would depend more on your situation. From what I've read people say to stay away from using the Entity Framework and LINQ to SQL apparently isn't being developed by Microsoft anymore in favor of the entity framework. If your looking to use LINQ in your project I would suggest looking into NHibernate and Castle ActiveRecord. It makes it incredibly easy to insert/update/delete as well as query from the database. There are generators out there that will generate the classes based on your SQL tables/relationships as well. Hope this helps.
Gage