Azavea.Open.DAO.Memory.MemoryDaLayer.Insert C# (CSharp) Method

Insert() public method

Inserts a data object record using the "table" and a list of column/value pairs.
public Insert ( ITransaction transaction, ClassMapping mapping, object>.IDictionary propValues ) : int
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table or other data container we're dealing with.
propValues object>.IDictionary A dictionary of "column"/value pairs for the object to insert.
return int
        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;
        }