本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
示例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;
}