示例#1
0
        private PersistentTable <TKey, TValue> CreateInstance()
        {
            var session = new Session(this.Instance);

            // Open the database.
            var database = OpenDatabase(session, Path.Combine(this.Directory, this.DatabaseFile));

            // Get a reference to the table.
            var table = new Table(session, database, this.TableName, OpenTableGrbit.None);

            // Get references to the columns.
            var columns = Api.GetColumnDictionary(session, table);

            var result = new PersistentTable <TKey, TValue>
            {
                Table         = table,
                Session       = session,
                KeyColumn     = columns["key"],
                ValueColumn   = columns["value"],
                SessionHandle = GCHandle.Alloc(session)
            };

            this.allInstances.Add(result);
            return(result);
        }
示例#2
0
 public void Return(PersistentTable <TKey, TValue> table)
 {
     this.pool.Add(table);
 }