I must be missing something, when trying to define a HABTM association with 2 of my models. I have a "Product" table, and a "Category" table, and a "ProductsCategories" join table. In SQL Server, I am defining the Relationship between the tables on the join table. However, when I create the LINQ to SQL model "Product," I get "Product.ProductCategories -> ProductCategory, ProductsCategory.Product -> Product" Is it possible in asp.net mvc to define a relationship that would give me Product.Categories or Category.Products?
+1
A:
Someone is surely wiser than me on the subject, but I don't know a way of doing this [automatically] if you are using a DBML file to autogenerate your database model. By knowing you can use Product.ProductCategories.Category
and Category.ProductCategories.Product
, you can create partial classes for Product and Category that define properties named Products
and Categories
which return Product.ProductCategories.Category, and Category.ProductCategories.Product.
Terje
2009-12-20 11:40:33
A nice workaround...
Greg B
2009-12-20 16:02:55