linq sql list dependency
if i have twin tables... problem pet.
is there proceed linq sql outcome assimilated query map another strongly typed category (such as: petwithcategoryname) i strongly pass mvc view?
i now have problem pet classes... should i another one?
maybe i blank something here. any illuminate me?
from p pettable
join c categorytable p.categoryid equals c.id
where (c.id == categoryid.value)
select new
{
p.id,
p.name,
p.description,
p.price,
categoryname = c.name
}
<?xml version="1.0" encoding="utf-8" ?>
<database name="petshop" xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007">
<table name="category" member="petshop.models.category">
<type name="petshop.models.category">
<column name="id" member="id" isdbgenerated="true" isprimarykey="true" />
<column name="name" member="name" />
<column name="description" member="description" />
</type>
</table>
<table name="pet" member="petshop.models.pet">
<type name="petshop.models.pet">
<column name="id" member="id" isdbgenerated="true" isprimarykey="true" />
<column name="name" member="name" />
<column name="description" member="description" />
<column name="imageurl" member="imageurl" />
<column name="price" member="price" />
<column name="categoryid" member="categoryid" />
<association name="fk_pet_category" member="category" thiskey="categoryid" otherkey="id" isforeignkey="true" />
</type>
</table>
</database>
Comments
Post a Comment