Exemplo n.º 1
0
        public void Init()
        {
            Context = Default.OfflineDataContext();

            // load regions
            var east = new Region {
                RegionID = RegionId.Eastern, RegionDescription = "Eastern"
            };
            var north = new Region {
                RegionID = RegionId.Northern, RegionDescription = "Northern"
            };
            var south = new Region {
                RegionID = RegionId.Southern, RegionDescription = "Southern"
            };
            var west = new Region {
                RegionID = RegionId.Western, RegionDescription = "Western"
            };

            Context.Regions.Add(east);
            Context.Regions.Add(north);
            Context.Regions.Add(south);
            Context.Regions.Add(west);


            // load territories
            var boston = new Territory {
                TerritoryID = TerritoryId.Boston, /*RegionID = east.RegionID,*/ Region = east, TerritoryDescription = "Boston"
            };

            Context.Territories.Add(boston);

            Context.AcceptChanges();
        }