コード例 #1
0
ファイル: Form1.cs プロジェクト: telerik/winforms-sdk
        public Form1()
        {
            InitializeComponent();

            this.data = new RadGridViewEFCodeFirstData();
            if (!data.OrderTypes.All().Any() || !data.Orders.All().Any() || !data.Shippers.All().Any())
            {
                DataGenerator.PopulateData(this.data);
            }

            this.SetUpGrid();
            this.FormClosing += Form1_FormClosing;
        }
コード例 #2
0
        public Form1()
        {
            InitializeComponent();

            this.data = new RadGridViewEFCodeFirstData();
            if (!data.OrderTypes.All().Any() || !data.Orders.All().Any() || !data.Shippers.All().Any())
            {
                DataGenerator.PopulateData(this.data);
            }

            this.SetUpGrid();
            this.FormClosing += Form1_FormClosing;
        }
コード例 #3
0
        public static void PopulateData(IRadGridViewEFCodeFirstData data)
        {
            for (int i = 1; i <= 100; i++)
            {
                OrderType orderType = new OrderType()
                {
                    OrderTypeId = i,
                    Description = "Test" + i
                };

                Order order = new Order()
                {
                    OrderId = i,
                    Description = "Description" + i,
                    OrderTypeId = orderType.OrderTypeId
                };

                Shipper shipper = new Shipper()
                {
                    ShipperId = i,
                    Name = "Name " + i,
                    OrderTypeId = orderType.OrderTypeId,
                    Address = "Address " + i,
                };

                data.OrderTypes.Add(orderType);
                data.Orders.Add(order);
                data.Shippers.Add(shipper);

                if (i % 100 == 0)
                {
                    data.SaveChanges();
                }
            }

            data.SaveChanges();
        }
コード例 #4
0
        public static void PopulateData(IRadGridViewEFCodeFirstData data)
        {
            for (int i = 1; i <= 100; i++)
            {
                OrderType orderType = new OrderType()
                {
                    OrderTypeId = i,
                    Description = "Test" + i
                };

                Order order = new Order()
                {
                    OrderId     = i,
                    Description = "Description" + i,
                    OrderTypeId = orderType.OrderTypeId
                };

                Shipper shipper = new Shipper()
                {
                    ShipperId   = i,
                    Name        = "Name " + i,
                    OrderTypeId = orderType.OrderTypeId,
                    Address     = "Address " + i,
                };

                data.OrderTypes.Add(orderType);
                data.Orders.Add(order);
                data.Shippers.Add(shipper);

                if (i % 100 == 0)
                {
                    data.SaveChanges();
                }
            }

            data.SaveChanges();
        }