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


C# Application.IsTransient方法代码示例

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


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

示例1: ConstructorTest

        public void ConstructorTest()
        {
            Application target = new Application();

            Assert.IsNotNull(target);
            Assert.IsTrue(target.IsTransient());
        }
开发者ID:ucdavis,项目名称:Recruitments,代码行数:7,代码来源:ApplicationTest.cs

示例2: SaveDeleteApplication

        public void SaveDeleteApplication()
        {
            Application target = new Application();

            target.AppliedPosition = NHibernateHelper.DaoFactory.GetPositionDao().GetById(StaticProperties.ExistingPositionID, false);
            target.AssociatedProfile = NHibernateHelper.DaoFactory.GetProfileDao().GetById(StaticProperties.ExistingProfileID, false);
            //target.ReferSource = NHibernateHelper.DaoFactory.GetReferSourceDao().GetUniqueByExample(new ReferSource("Internet"));

            target.Email = StaticProperties.TestString;
            target.LastUpdated = DateTime.Now;
            target.Submitted = false;

            Assert.IsTrue(ValidateBO<Application>.isValid(target));

            Assert.IsTrue(target.IsTransient());

            using (var ts = new TransactionScope())
            {
                target = NHibernateHelper.DaoFactory.GetApplicationDao().SaveOrUpdate(target);

                ts.CommitTransaction();
            }

            Assert.IsFalse(target.IsTransient());

            Application targetDB = NHibernateHelper.DaoFactory.GetApplicationDao().GetById(target.ID, false);

            Assert.AreEqual<Application>(target, targetDB);

            this.TestContext.WriteLine("Application Created had ID = {0}", target.ID);

            using (var ts = new TransactionScope())
            {
                NHibernateHelper.DaoFactory.GetApplicationDao().Delete(target);

                ts.CommitTransaction();
            }

            //Make sure it is deleted
            bool isDeleted = false;

            try
            {
                target = NHibernateHelper.DaoFactory.GetApplicationDao().GetById(targetDB.ID, false);
                target.IsTransient();
            }
            catch (NHibernate.ObjectNotFoundException)
            {
                isDeleted = true;
            }

            Assert.IsTrue(isDeleted);
        }
开发者ID:ucdavis,项目名称:Recruitments,代码行数:53,代码来源:ApplicationTest.cs


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