Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Using component

  • Loading branch information...
commit b40071cad3a22139e6176fa50f51b54f93a615a7 1 parent 50f0ff2
@ayende authored
Showing with 27 additions and 17 deletions.
  1. +10 −8 Course/Models/User.cs
  2. +17 −9 Course/Models/User.hbm.xml
View
18 Course/Models/User.cs
@@ -10,15 +10,17 @@ public class User
public virtual ICollection<Group> Groups { get; set; }
public virtual ICollection<Part> Parts { get; set; }
- public virtual string WorkAddressLine1 { get; set; }
- public virtual string WorkAddressLine2 { get; set; }
- public virtual string WorkAddressState { get; set; }
- public virtual string WorkAddressCity { get; set; }
+ public virtual Address WorkAddress { get; set; }
- public virtual string HomeAddressLine1 { get; set; }
- public virtual string HomeAddressLine2 { get; set; }
- public virtual string HomeAddressState { get; set; }
- public virtual string HomeAddressCity { get; set; }
+ public virtual Address HomeAddress { get; set; }
+ }
+
+ public class Address
+ {
+ public string Line1 { get; set; }
+ public string Line2 { get; set; }
+ public string State { get; set; }
+ public string City { get; set; }
}
public class Admin : User
View
26 Course/Models/User.hbm.xml
@@ -18,22 +18,30 @@
<many-to-many column="GroupId" class="Group"/>
</set>
- <property name="WorkAddressLine1"/>
- <property name="WorkAddressLine2"/>
- <property name="WorkAddressCity"/>
- <property name="WorkAddressState"/>
+ <component name="WorkAddress">
+ <property name="Line1" column="WorkAddressLine1"/>
+ <property name="Line2" column="WorkAddressLine2"/>
+ <property name="City" column="WorkAddressCity"/>
+ <property name="State" column="WorkAddressState"/>
- <property name="HomeAddressLine1"/>
- <property name="HomeAddressLine2"/>
- <property name="HomeAddressCity"/>
- <property name="HomeAddressState"/>
+ </component>
+
+
+ <component name="HomeAddress">
+
+ <property name="Line1" column="HomeAddressLine1"/>
+ <property name="Line2" column="HomeAddressLine2"/>
+ <property name="City" column="HomeAddressCity"/>
+ <property name="State" column="HomeAddressState"/>
+
+ </component>
<union-subclass name="Admin" table="Admins">
<property name="Password" />
</union-subclass>
-
+
</class>
Please sign in to comment.
Something went wrong with that request. Please try again.