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?
Share
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.CategoryandCategory.ProductCategories.Product, you can create partial classes for Product and Category that define properties namedProductsandCategorieswhich return Product.ProductCategories.Category, and Category.ProductCategories.Product.