コード例 #1
0
ファイル: Dev10EF4FKTests.cs プロジェクト: zdzislaw/odata.net
        public void EFFK_InsertAddRelated()
        {
            var newCust = new EFFKClient.Customer()
            {
                ID = 11, EditTimeStamp = new byte[] { 0 }
            };
            var newOrder1 = new EFFKClient.Order()
            {
                ID = 100020, CustomerId = 11
            };
            var newOrder2 = new EFFKClient.Order()
            {
                ID = 100021, CustomerId = 1
            };
            var newOrder3 = new EFFKClient.Order()
            {
                ID = 100022
            };

            ctx.AddObject("CustomObjectContext.Customers", newCust);
            ctx.AddRelatedObject(newCust, "Orders", newOrder1);
            ctx.AddRelatedObject(newCust, "Orders", newOrder2);
            ctx.AddRelatedObject(newCust, "Orders", newOrder3);

            ctx.SaveChanges();

            VerifyServerOrderId(100020, 11);
            VerifyServerOrderId(100021, 11);
            VerifyServerOrderId(100022, 11);
        }
コード例 #2
0
ファイル: Dev10EF4FKTests.cs プロジェクト: larsenjo/odata.net
        public void EFFK_InsertAddRelated()
        {
            var newCust = new EFFKClient.Customer() { ID = 11, EditTimeStamp = new byte[] { 0 } };
            var newOrder1 = new EFFKClient.Order() { ID = 100020, CustomerId = 11 };
            var newOrder2 = new EFFKClient.Order() { ID = 100021, CustomerId = 1 };
            var newOrder3 = new EFFKClient.Order() { ID = 100022 };

            ctx.AddObject("CustomObjectContext.Customers", newCust);
            ctx.AddRelatedObject(newCust, "Orders", newOrder1);
            ctx.AddRelatedObject(newCust, "Orders", newOrder2);
            ctx.AddRelatedObject(newCust, "Orders", newOrder3);

            ctx.SaveChanges();

            VerifyServerOrderId(100020, 11);
            VerifyServerOrderId(100021, 11);
            VerifyServerOrderId(100022, 11);
        }