public void LogAsync(InternalQualifier qualifier)
 {
     lock(_tmpQualifiers)
         _tmpQualifiers.Add(new TemporaryQualifier(qualifier, DateTime.Now));
 }
 public bool Equals(InternalQualifier other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.PartId == PartId && other.LocaleId == LocaleId && Equals(_lowerKey, other._lowerKey);
 }
 public DBValue(long partId, int localeId, String key, String content)
 {
     Qualifier = new InternalQualifier(partId, localeId, key);
     Content = content;
 }
            public void Update(InternalQualifier qualifier, string value, Connector connector)
            {
                var connection = connector.Connection;
                if (connection.State != ConnectionState.Open)
                    connection.Open();

                if (_valuesByQualifier[qualifier].Content.Equals(value))
                    return;

                _valuesByQualifier[qualifier].Content = value;

                var command = new SqlCommand(String.Format(
                        "update {0} set {1} = @content where {2} = @part and {3} = @locale and {4} = @key",
                        _table, ContentColumn, PartIdColumn, LocaleIdColumn, KeyColumn
                    ), connection
                );

                command.Parameters.Add(new SqlParameter("content", SqlDbType.VarChar) {Value = value});
                command.Parameters.Add(new SqlParameter("part", SqlDbType.BigInt) {Value = qualifier.PartId});
                command.Parameters.Add(new SqlParameter("locale", SqlDbType.Int) { Value = qualifier.LocaleId });
                command.Parameters.Add(new SqlParameter("key", SqlDbType.VarChar) { Value = qualifier.Key });
                command.ExecuteNonQuery();
            }
            public void Delete(InternalQualifier qualifier, Connector connector)
            {
                var connection = connector.Connection;
                if (connection.State != ConnectionState.Open)
                    connection.Open();

                var command = new SqlCommand(String.Format(
                        "delete from {0} where {1} = @part and {2} = @locale and {3} = @key",
                        _table, PartIdColumn, LocaleIdColumn, KeyColumn
                    ), connection
                );

                command.Parameters.Add(new SqlParameter("part", SqlDbType.BigInt) { Value = qualifier.PartId });
                command.Parameters.Add(new SqlParameter("locale", SqlDbType.Int) { Value = qualifier.LocaleId });
                command.Parameters.Add(new SqlParameter("key", SqlDbType.VarChar) { Value = qualifier.Key });
                command.ExecuteNonQuery();

                if (_valuesByQualifier.ContainsKey(qualifier))
                    _valuesByQualifier.Remove(qualifier);
            }
 public TemporaryQualifier(InternalQualifier qualifer, DateTime time)
 {
     Qualifer = qualifer;
     Time = time;
 }