views:

294

answers:

3

Hello, I am new in asp.net MVC, and in Entity Framework to. I watch on asp.net mvc tutorials, but they are very easy. I need to write little site, and in my database have one-to-many reletionship. if i want to select data from two tables (classic inner join), what you recommended to use, db views or Linq to Entity queries. If Ling to Entity, please share with me little tutorial about how to do this in asp.net mvc. or give some advices.

best regards.

+2  A: 

You could have a look at the NerdDinner tutorial at scottgu's site. It is a very basic application using LINQ to SQL. The read is quite good though and while I have never really used it (i am using ADO.net entities) I did learn quickly how to use ASP.net MVC.

So for a good read:

http://nerddinnerbook.s3.amazonaws.com/Intro.htm

bastijn
thanks, good tutorial to start.
loviji
+2  A: 

If you just create a FK relationship between the two tables, EF will automagically create the association between them, and do an auto-join when you request him to do.

Jan Jongboom
+1  A: 

I'd recommend taking a look at Rob Conery's series on Commerce MVC (or just grab the code and check out his implementation). It has a nice clean data layer and has support for lazy loading.

Craig M