예제 #1
0
        public InheritanceCustomersController()
        {
            InheritanceAddress address = new InheritanceAddress
            {
                City   = "Tokyo",
                Street = "Tokyo Rd"
            };

            InheritanceAddress usAddress = new InheritanceUsAddress
            {
                City    = "Redmond",
                Street  = "One Microsoft Way",
                ZipCode = 98052
            };

            InheritanceAddress cnAddress = new InheritanceCnAddress
            {
                City     = "Shanghai",
                Street   = "ZiXing Rd",
                PostCode = "200241"
            };

            _customers = Enumerable.Range(1, 5).Select(e =>
                                                       new InheritanceCustomer
            {
                Id       = e,
                Location = new InheritanceLocation
                {
                    Name    = "Location #" + e,
                    Address = e < 3 ? address : e < 4 ? usAddress : cnAddress
                }
            }).ToList();
        }
        public InheritanceCustomersController()
        {
            InheritanceAddress address = new InheritanceAddress
            {
                City = "Tokyo",
                Street = "Tokyo Rd"
            };

            InheritanceAddress usAddress = new InheritanceUsAddress
            {
                City = "Redmond",
                Street = "One Microsoft Way",
                ZipCode = 98052
            };

            InheritanceAddress cnAddress = new InheritanceCnAddress
            {
                City = "Shanghai",
                Street = "ZiXing Rd",
                PostCode = "200241"
            };

            _customers = Enumerable.Range(1, 5).Select(e =>
                new InheritanceCustomer
                {
                    Id = e,
                    Location = new InheritanceLocation
                    {
                        Name = "Location #" + e,
                        Address = e < 3 ? address : e < 4 ? usAddress : cnAddress
                    }
                }).ToList();
        }