views:

44

answers:

2

Hi Experts, I am working on a project for automobiles listing. I am using linq to entities. I have a table listing and corresponding a class Listing in my data model.

Listing 
{
Listingid,
AccountID,
MakeId,
ModelId
}

I have lookup table where I keep all the lookup values for makes and models.

Lookupvalues
{
id,
Description
}

I havent created join between these tables yet.

Now, In a display page I have to display all the corresponding values from the lookup tables for makes and models, how should I fetch them. I have written a partial Listing class and created all these descripiton properties

public partial class Listing
{

MakeDescription
ModelDescription

}

I wrote stored procedure which joins the tables but it doesnt load the description properties in partial class.

What should I do ??

Thanks Parminder

A: 

Try ADO.NET Entity Framework Extensions, this should help.


Devart Team
http://www.devart.com/dotconnect
ADO.NET data providers for Oracle, MySQL, PostgreSQL, SQLite with Entity Framework and LINQ to SQL support

Devart
thanks a lot for this help
Parminder
A: 

I havent created join between these tables yet.

There is your problem. You should model this as associatons between Listing and LookupValues. Once you do that, you won't need your partial class anymore, as you can just project out what you need for display:

from l in Context.Listings
select new 
{
    Listingid = l.Listingid,
    AccountID = l.AccountID,
    MakeDescription = l.Make.Description,
    ModelDescription = l.Model.Description
}
Craig Stuntz