Azavea.Open.DAO.Memory.MemoryObject.GetKey C# (CSharp) Method

GetKey() public method

Returns a unique (or as unique as the original object's IDs anyway) single key.
public GetKey ( ) : string
return string
        public string GetKey()
        {
            StringBuilder sb = DbCaches.StringBuilders.Get();
            foreach (string col in _mapping.IdDataColsByObjAttrs.Values)
            {
                sb.Append(ColValues[col]).Append("_");
            }
            return sb.ToString();
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Inserts a data object record using the "table" and a list of column/value pairs.
 /// </summary>
 /// <param name="transaction">The transaction to do this as part of.</param>
 /// <param name="mapping">The mapping of the table or other data container we're dealing with.</param>
 /// <param name="propValues">A dictionary of "column"/value pairs for the object to insert.</param>
 /// <returns>The number of records affected.</returns>
 public override int Insert(ITransaction transaction, ClassMapping mapping, IDictionary<string, object> propValues)
 {
     IDictionary<string, MemoryObject> table = GetTable(mapping);
     foreach (string colName in mapping.IdDataColsByObjAttrs.Values)
     {
         propValues[colName] = GetNextAutoGeneratedId(mapping, colName);
     }
     MemoryObject obj = new MemoryObject(mapping, propValues);
     lock (table)
     {
         table[obj.GetKey()] = obj;
     }
     return 1;
 }