Today, I’ll talk about another feature in VS2008 beta 2, Object Relational Designer (O/R Designer), briefly for who are used sqlmental.exe LINQ CTP days, this tool replaced it with Designer tool for creating LINQ to SQL (DLINQ) entity classes and associations based on database objects plus mapping database stored procedures and user defined function to Data Context for returning data. then from VS menu project then add new item and select LINQ to SQL Classes as shown used pubs database
Data Context methods: method call database stored procedures and user defined functions and return sets.
Let’s play with (O/R Designer),
First create project from Console application type
(O/R Designer) surface will open and that’s time to drag database objects from server explorer (this requires you’ve a connection to database) and drop it on.
Hint: (O\R Designer) works just on SQL Server 2000 and later versions. In my sample I’ve
After dragging all tables and stored procedures, I found that (O\R Designer) has visualized my tables as entity classes and my stored procedure as Data Context methods
Let’s have some code to print all authors’ first names from authors table and execute ByRoylaty stored procedure
And this the result
then from VS menu project then add new item and select LINQ to SQL Classes as shown
used pubs database