当前位置: 首页>>代码示例>>C#>>正文


C# IZetboxContext.SubmitChanges方法代码示例

本文整理汇总了C#中IZetboxContext.SubmitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# IZetboxContext.SubmitChanges方法的具体用法?C# IZetboxContext.SubmitChanges怎么用?C# IZetboxContext.SubmitChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IZetboxContext的用法示例。


在下文中一共展示了IZetboxContext.SubmitChanges方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

        public override void SetUp()
        {
            base.SetUp();

            ctx = GetContext();
            var principalResolver = scope.Resolve<IPrincipalResolver>();

            var currentPrincipal = principalResolver.GetCurrent();

            Assert.That(currentPrincipal, Is.Not.Null, "No current identity found - try syncidentities or setup the current identity correctly");

            identity1 = ctx.Find<Identity>(currentPrincipal.ID);
            identity2 = ctx.GetQuery<Identity>().Where(i => i.ID != identity1.ID).First();

            parent = ctx.Create<SecurityTestParent>();
            parent.Name = "MyParent";

            child1 = ctx.Create<SecurityTestChild>();
            child1.Name = "Child1";
            child1.Identity = identity1;
            child1.Parent = parent;

            child2 = ctx.Create<SecurityTestChild>();
            child2.Name = "Child2";
            child2.Identity = identity2;
            child2.Parent = parent;

            ctx.SubmitChanges();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:29,代码来源:AbstractSecurityTest.cs

示例2: SetUp

 public override void SetUp()
 {
     base.SetUp();
     ctx = scope.Resolve<IZetboxContext>();
     ilvm = vmf.CreateViewModel<InstanceListViewModel.Factory>().Invoke(ctx, null, (ObjectClass)NamedObjects.Base.Classes.Zetbox.App.Test.One_to_N_relations_N.Find(ctx), null);
     obj = ctx.Create<One_to_N_relations_N>();
     ctx.SubmitChanges();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:8,代码来源:InstanceListTests.cs

示例3: SetUp

        public override void SetUp()
        {
            base.SetUp();

            ctx = GetContext();

            one = ctx.Create<One_to_N_relations_One>();
            n1 = ctx.Create<One_to_N_relations_N>();
            n2 = ctx.Create<One_to_N_relations_N>();

            one.NSide.Add(n1);
            one.NSide.Add(n2);

            ctx.SubmitChanges();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:15,代码来源:when_deleting_one_to_n.cs

示例4: SetUp

        public override void SetUp()
        {
            base.SetUp();

            ctx = GetContext();

            a1 = ctx.Create<N_to_M_relations_A>();
            b1 = ctx.Create<N_to_M_relations_B>();
            b2 = ctx.Create<N_to_M_relations_B>();

            a1.BSide.Add(b1);
            a1.BSide.Add(b2);

            ctx.SubmitChanges();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:15,代码来源:when_deleting_n_m.cs

示例5: InitTestObjects

 public void InitTestObjects()
 {
     ctx = GetContext();
     oneSide1 = ctx.Create<One_to_N_relations_One>();
     oneSide2 = ctx.Create<One_to_N_relations_One>();
     oneSide3 = ctx.Create<One_to_N_relations_One>();
     nSide1 = ctx.Create<One_to_N_relations_N>();
     nSide1.OneSide = oneSide3;
     nSide2 = ctx.Create<One_to_N_relations_N>();
     nSide2.OneSide = oneSide3;
     ctx.SubmitChanges();
     ctx = GetContext();
     oneSide1 = ctx.Find<One_to_N_relations_One>(oneSide1.ID);
     oneSide2 = ctx.Find<One_to_N_relations_One>(oneSide2.ID);
     oneSide3 = ctx.Find<One_to_N_relations_One>(oneSide3.ID);
     nSide1 = ctx.Find<One_to_N_relations_N>(nSide1.ID);
     nSide2 = ctx.Find<One_to_N_relations_N>(nSide2.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:18,代码来源:should_synchronize.cs

示例6: SetUp

        public override void SetUp()
        {
            base.SetUp();

            ctx = GetContext();

            one1 = ctx.Create<One_to_N_relations_One>();
            one2 = ctx.Create<One_to_N_relations_One>();
            n1 = ctx.Create<One_to_N_relations_N>();
            n2 = ctx.Create<One_to_N_relations_N>();

            one1.Name = "One1";
            one2.Name = "One2";
            n1.Name = "N1";
            n2.Name = "N2";

            one1.NSide.Add(n1);
            one1.NSide.Add(n2);

            ctx.SubmitChanges();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:21,代码来源:when_changing_one_to_n.cs

示例7: CreateTestData

        /// <summary>
        /// Creates a few new test objects
        /// </summary>
        /// <param name="ctx">this context is used to create the objects</param>
        public static void CreateTestData(IZetboxContext ctx)
        {
            var kunde = ctx.Create<Kunde>();
            kunde.EMails.Add("[email protected]");
            kunde.EMails.Add("[email protected]");
            kunde.Kundenname = "com Kunde";
            kunde.PLZ = "1111";

            kunde = ctx.Create<Kunde>();
            kunde.EMails.Add("[email protected]");
            kunde.Kundenname = "net Kunde";
            kunde.PLZ = "2222";

            kunde = ctx.Create<Kunde>();
            kunde.Kundenname = "empty Kunde";
            kunde.PLZ = "3333";

            kunde = ctx.Create<Kunde>();
            kunde.EMails.Add("[email protected]");
            kunde.EMails.Add("[email protected]");
            kunde.EMails.Add("[email protected]");
            kunde.EMails.Add("[email protected]");
            kunde.Kundenname = "org Kunde";
            kunde.PLZ = "4444";

            var prj = ctx.Create<Projekt>();
            prj.Name = "Zetbox";

            var task1 = ctx.Create<Task>();
            task1.Name = "task1";
            task1.Projekt = prj;

            var task2 = ctx.Create<Task>();
            task2.Name = "task2";
            task2.Projekt = prj;

            var ma1 = ctx.Create<Mitarbeiter>();
            ma1.Geburtstag = new DateTime(1960, 01, 02);
            ma1.Name = "Mitarbeiter Alpha";
            ma1.SVNr = "123456789";
            ma1.TelefonNummer = "+43664123456789";

            var ma2 = ctx.Create<Mitarbeiter>();
            ma2.Geburtstag = new DateTime(1970, 12, 30);
            ma2.Name = "Mitarbeiter Beta";
            ma2.SVNr = "987654321";
            ma2.TelefonNummer = "+43664987654321";

            // Make nHibernate happy
            ctx.SubmitChanges();

            ma2.Projekte.Add(prj);
            ma1.Projekte.Add(prj);
        }
开发者ID:daszat,项目名称:zetbox,代码行数:58,代码来源:ProjectDataFixture.cs

示例8: TearDown

        public override void TearDown()
        {
            ctx = GetContext();
            ReloadObjects(ctx);
            ctx.Delete(one1);
            ctx.Delete(one2);
            ctx.Delete(n1);
            ctx.Delete(n2);
            ctx.SubmitChanges();

            base.TearDown();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:12,代码来源:when_changing_one_to_n.cs

示例9: TearDown

 public override void TearDown()
 {
     ctx = GetContext();
     var tdObj = ctx.GetQuery<Assembly>().Where(a => a.ID == originalId);
     foreach (var o in tdObj.ToList())
     {
         ctx.Delete(o);
     }
     ctx.SubmitChanges();
     base.TearDown();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:11,代码来源:when_submitting.cs

示例10: ClearDestination

        /// <summary>
        /// Clears the destination zetbox tables. Due to FKs, ordering is required.
        /// </summary>
        private void ClearDestination(IZetboxContext ctx)
        {
            foreach (var log in ctx.GetQuery<MigrationLog>())
            {
                ctx.Delete(log);
            }
            ctx.SubmitChanges();

            // required ordering
            //executor.CleanDestination(tables["tbl_Cars"]);
            //executor.CleanDestination(tables["tbl_Customers"]);
        }
开发者ID:daszat,项目名称:zetbox,代码行数:15,代码来源:Program.cs


注:本文中的IZetboxContext.SubmitChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。