This project is read-only.

Associative Table with extra fields

Jan 25, 2010 at 4:37 PM

How would you implement a N->M Associative Table where you need to have additional fields in the Associative Table.  For example, you have CUSTOMERS and PRODUCTS tables,  but now you need an Associatve Table that links them (CUSTOMERS_PRODUCTS) but also includes QUANTITY, ORDERDATE, etc. 

Jan 26, 2010 at 4:23 AM

While you are using what is essentially a type table, a defined type table cannot have extra properties in it. Or more appropriately you cannot access the extra properties. This type of table is designed such that is it invisible to the C# code and will only be used to walk the relationship between the other two entities. The entity in the middle (type table) is not exposed. So you can still do what you want but you cannot mark the table as a "type" table. This means that you will see the middle table in your code. This has the added advantage of letting you add as many fields as you like to the entity, but the hidden walking is gone and you will have to walk from T1->MiddleTable->T2.

Jan 26, 2010 at 5:12 AM
Edited Jan 26, 2010 at 5:12 AM

Yes I see what you are saying thanks.  Are there some simple Winforms examples anywhere that would demonstrate the proper many-to-many interaction between nHydrate and the form with a T1->MiddleTable->T2 setup?

Jan 28, 2010 at 6:43 PM

I do not have any to give you right now. We are working on only on web development currently. I will try to put some together soon.