public void Insert(UserModel model) { var item = _provider.GetItem(" AND Username=@Username", new { Username = model.Username }); if (item != null) { throw new Exception("已存在相同用户名的用户"); } _provider.Insert(model); }