tags:

views:

46

answers:

1

When you setup linq, it maps all your tables to objects, I get that.

Now what happens when your linq query is inner joining with another table?

I read on here that it returns an anonymous object?

What if I have an object that maps to the columns in the inner join of 2 tables, how do I map?

Just looping through the collection as if it was a datareader and init my object and add it to a List?

+1  A: 

Its not an anon type, below, I have the generated property for "PrinterTrays", in my case I have 1:M relationship between Printer and PrinterTray

[Association(Name="Printer_PrinterTray", Storage="_PrinterTrays", ThisKey="PrinterID", OtherKey="PrinterID")]
public EntitySet<PrinterTray> PrinterTrays
{
    get
    {
     return this._PrinterTrays;
    }
    set
    {
     this._PrinterTrays.Assign(value);
    }
}

I'm assuming you're talking about joins that have proper pk / fk / constraints on them.

Really tho, with the power of linq and delayed execution, you can do some really awesome stuff by piping your data into your own data types or anon types to be serialized for say json.

you need to watch these videos on linq to sql and these videos on linqpad

Allen