This blog is subject the DISCLAIMER below.

Thursday, August 30, 2007

Object Relational Designer (O/R Designer)

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.

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


then from VS menu project then add new item and select LINQ to SQL Classes as shown
(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

used pubs database
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


4 comments:

م-هويدي said...

great,
really a great thing for .net to support ORM frameworks

is it build on top of LINQ framework or is it a new ORM framework ?

م-هويدي said...

بس على فكره ، الكلام ده خطيير جدا

ده معناه إن المبرمج فقط هيصمم الصفحات ( هيبقي ديزينر ) + و هينادي على الدوال في المكان المناسب

و بكده ميروسوفت عنلت كول حاجه ، كتبت كود الأكسس للداتا بيز و كتبت اللوجيك بتاع البرنامج
فاضل إيه بقه

إن لله و إنا إليه راجعون
لاحول ولال قوة إلا بالله

Ramy Mahrous said...

It's built on LINQ.

They don't generate Business Logic Layer (BLL), they just do mapping to database objects as I mentioned to entity classes and to SPs and UDFs to Data Context methods.

It's not new thing, my GP. (SAT) has these features.

Yes, they made life easier, any technology should be and do.

م-هويدي said...

Thanks for your kindly comment