Ejemplo n.º 1
0
        /// <summary>
        /// Creates a CassandraUser from a Row.  If the Row is null, returns null.
        /// </summary>
        internal static CassandraUser FromRow(Row row)
        {
            if (row == null)
            {
                return(null);
            }

            var user = new CassandraUser(row.GetValue <Guid>("userid"), row.GetValue <Guid>("tenantid"), row.GetValue <string>("username"), row.GetValue <string>("email"))
            {
                PasswordHash           = row.GetValue <string>("password_hash"),
                SecurityStamp          = row.GetValue <string>("security_stamp"),
                IsTwoFactorEnabled     = row.GetValue <bool>("two_factor_enabled"),
                AccessFailedCount      = row.GetValue <int>("access_failed_count"),
                IsLockoutEnabled       = row.GetValue <bool>("lockout_enabled"),
                LockoutEndDate         = row.GetValue <DateTimeOffset>("lockout_end_date"),
                PhoneNumber            = row.GetValue <string>("phone_number"),
                IsPhoneNumberConfirmed = row.GetValue <bool>("phone_number_confirmed"),
                IsEmailConfirmed       = row.GetValue <bool>("email_confirmed"),
                Created  = row.GetValue <DateTimeOffset>("created"),
                Modified = row.IsNull("modified") ? new DateTimeOffset?() : row.GetValue <DateTimeOffset>("modified"),
                Enabled  = row.GetValue <bool>("enabled"),
                Source   = row.GetValue <string>("source"),
                SourceId = row.GetValue <string>("source_id")
            };

            return(user);
        }
Ejemplo n.º 2
0
 public async Task DeleteAsync(CassandraUser user)
 {
     await TryWithAwaitInCatch.ExecuteAndHandleErrorAsync(
         async() =>
     {
         await ResilientSessionContainer.EstablishSessionAsync();
         await ResilientSessionContainer.ResilientSession.DeleteUserAsync(user);
     },
         async (ex) => ResilientSessionContainer.HandleCassandraException <Task>(ex));
 }