root/UnityWeb/UnityWeb/Repository/NHibernateDataAccess/Mapping/EmployeeMap.cs

5556
15
        public EmployeeMap()
15
        public EmployeeMap()
16
        {
16
        {
17
            WithTable("Employees");
17
            WithTable("Employees");
18
            Id(x => x.Id, "EmployeeID").GeneratedBy.Identity();
18
            base.Id(x => x.Id, "EmployeeID").GeneratedBy.Identity();
19
19
20
            //non-nullable string with a length of 16
20
            //non-nullable string with a length of 16
21
            //Map(x => x.).WithLengthOf(16).CanNotBeNull();
21
            //base.Map(x => x.).WithLengthOf(16).CanNotBeNull();
22
22
23
            //simple properties
23
            //simple properties
24
            Map(x => x.Salutation, "TitleOfCourtesy").WithLengthOf(25);
24
            base.Map(x => x.Salutation, "TitleOfCourtesy").WithLengthOf(25);
25
            Map(x => x.FirstName).WithLengthOf(10);
25
            base.Map(x => x.FirstName).WithLengthOf(10);
26
            Map(x => x.LastName).WithLengthOf(20);
26
            base.Map(x => x.LastName).WithLengthOf(20);
27
            Map(x => x.JobTitle,"Title").WithLengthOf(30);
27
            base.Map(x => x.JobTitle, "Title").WithLengthOf(30);
28
           // Map(x => x.BirthDate);
28
            // base.Map(x => x.BirthDate);
29
           /*  Map(x => x.HireDate);
29
            /*  base.Map(x => x.HireDate);
30
           Map(x => x.Phone,"HomePhone").WithLengthOf(24);
30
           base.Map(x => x.Phone,"HomePhone").WithLengthOf(24);
31
31
32
            Component<Address>(employee => employee.Address,
32
            Component<Address>(employee => employee.Address,
33
                             address =>
33
                             address =>
34
                             {
34
                             {
35
                                 address.Map(a => a.City).WithLengthOf(15);
35
                                 address.base.Map(a => a.City).WithLengthOf(15);
36
                                 address.Map(a => a.CountryRegionName).WithLengthOf(15);
36
                                 address.base.Map(a => a.CountryRegionName).WithLengthOf(15);
37
                                 address.Map(a => a.PostalCode).WithLengthOf(10);                                
37
                                 address.base.Map(a => a.PostalCode).WithLengthOf(10);                                
38
                                 address.Map(a => a.StateProvinceName).WithLengthOf(15);
38
                                 address.base.Map(a => a.StateProvinceName).WithLengthOf(15);
39
                                 address.Map(a => a.AddressLine1,"Address").WithLengthOf(60);
39
                                 address.base.Map(a => a.AddressLine1,"Address").WithLengthOf(60);
40
                             }
40
                             }
41
              ); */
41
              ); */
42
        }
42
        }