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


C# User.ValidateAndThrow方法代码示例

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


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

示例1: Save

 public void Save(User user)
 {
     try
     {
         user.ValidateAndThrow();
         UserDao.Save(user);
     }
     catch (Exception exception)
     {
         Logger.Error(exception);
         throw;
     }
 }
开发者ID:JakobLaverdiere,项目名称:StreamusServer,代码行数:13,代码来源:UserManager.cs

示例2: Save

        public void Save(User user)
        {
            try
            {
                NHibernateSessionManager.Instance.BeginTransaction();

                user.ValidateAndThrow();
                UserDao.Save(user);

                NHibernateSessionManager.Instance.CommitTransaction();
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                NHibernateSessionManager.Instance.RollbackTransaction();
                throw;
            }
        }
开发者ID:hihihippp,项目名称:Streamus,代码行数:18,代码来源:UserManager.cs

示例3: CreateUser

        /// <summary>
        ///     Creates a new User and saves it to the DB. As a side effect, also creates a new, empty
        ///     Playlist and also saves it to the DB.
        /// </summary>
        /// <returns>The created user with a generated GUID</returns>
        public User CreateUser(string googlePlusId = "")
        {
            User user;

            try
            {
                user = new User
                    {
                        GooglePlusId = googlePlusId
                    };

                user.ValidateAndThrow();
                UserDao.Save(user);
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                throw;
            }

            return user;
        }
开发者ID:zeemEU,项目名称:StreamusServer,代码行数:27,代码来源:UserManager.cs

示例4: CreateUser

        /// <summary>
        ///     Creates a new User and saves it to the DB. As a side effect, also creates a new, empty
        ///     Folder (which has a new, empty Playlist) for the created User and saves it to the DB.
        /// </summary>
        /// <returns>The created user with a generated GUID</returns>
        public User CreateUser()
        {
            User user;

            try
            {
                NHibernateSessionManager.Instance.BeginTransaction();

                user = new User();
                user.ValidateAndThrow();
                UserDao.Save(user);

                NHibernateSessionManager.Instance.CommitTransaction();
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                NHibernateSessionManager.Instance.RollbackTransaction();
                throw;
            }

            return user;
        }
开发者ID:hihihippp,项目名称:Streamus,代码行数:28,代码来源:UserManager.cs


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