I want to write classes in C# using class Diagram .it includes converting 1 to many ,many to many etc relationships into actual classes. I don't remember rules .
This might be a silly question but i am unable to find any link that helps me in this matter without tool support.
Kindly Help me and Thanks in Advance.
Asked
Active
Viewed 3,869 times
2

Charlie
- 4,827
- 2
- 31
- 55
-
Here's a good SO question on how to do many-to-many: http://stackoverflow.com/q/1306064/945456 – Jeff B Oct 04 '13 at 19:12
-
If you have a screenshot of your UML class diagram, that might be useful to add to your question. It'll give us something concrete to work off of. – Jeff B Oct 04 '13 at 19:13
-
`helps me in this matter without tool support` - You want to write your own UML to C# Code Generator? If not then see: http://msdn.microsoft.com/en-us/library/vstudio/ff657795.aspx – Habib Oct 04 '13 at 19:13
-
I don't want to use any Code Generater ...Class Diagram is made on paper and i simply want to write classes in C# looking at this diagram – Charlie Oct 04 '13 at 19:15
-
@JeffBridgman I just added my class Diagram ... Kindly look. – Charlie Oct 04 '13 at 19:24
-
This sounds a hotel or something ;) Before I answer, let me clarify a few things: [1] a customer can stay in multiple rooms? (Implied by the 1:M relationship) [2] Does `Floor` have a connection to anything? [3] The various elements across the bottom... are they subclasses of `Room`? If so, is the purpose of `Room.Type` to be a display value? – Jeff B Oct 05 '13 at 04:45
-
@JeffBridgman its like one customer can stay in many rooms but one room can be occupied by many customers and Room is inherited by Floor I just need the rules to make classes – Charlie Oct 06 '13 at 16:55
-
So the diagram is wrong and it's really a many-to-many relationship between Customer and Room? If so, you need to rethink you're class structure... for example, you could have a `Reservation` class with a list of rooms reserved, each room could have a list of customers staying in it, and the reservation could have the customer that's paying. Also, you can't have an inheritance structure between Floor/Room (no matter which inherits which) - a Floor is not a Room, and a Room is not a Floor. – Jeff B Oct 07 '13 at 02:20
-
Your generalizations go the wrong way. You've stated that a Room is both Standerd, Moderate, Superior, JuniorSuite and Suite, all at the same time. Also, it's a bit strange to use generalizations at all since you've got a Type field in the Room class. – Uffe Oct 14 '13 at 20:51