/// <summary> /// Create/Get Data Store for IPersistent typed Key and "Simple typed" Value. /// NOTE: Simple type means one of the integer, numeric(decimals,...), char data types, byte array /// or a string /// </summary> /// <typeparam name="TKey"></typeparam> /// <typeparam name="TValue"></typeparam> /// <param name="createIfNotExist"></param> /// <param name="container"></param> /// <param name="comparer"></param> /// <param name="name"></param> /// <param name="isDataInKeySegment"> </param> /// <param name="mruManaged"> </param> /// <returns></returns> public ISortedDictionary <TKey, TValue> GetPersistentKey <TKey, TValue>(object container, string name, System.Collections.Generic.IComparer <TKey> comparer = null, bool createIfNotExist = true, bool isDataInKeySegment = true, bool mruManaged = true) where TKey : IPersistent, new() { if (!CollectionOnDisk.IsSimpleType(typeof(TValue))) { throw new ArgumentException(string.Format("Type of TValue ({0}) isn't an SOP simple type.", typeof(TValue))); } BTreeAlgorithm.CurrentOnValueUnpack = PersistentTypeKeySimpleValue <TKey, TValue> .Collection_OnKeyUnpack; var r2 = CreateDictionary <PersistentTypeKeySimpleValue <TKey, TValue>, TKey, TValue>(createIfNotExist, container, name, containerDod => { var r = new PersistentTypeKeySimpleValue <TKey, TValue >( container, comparer, name, DataStoreType . SopOndisk, null, isDataInKeySegment); containerDod. SetCurrentValueInMemoryData (r); return(r); }, mruManaged); return(r2); }
/// <summary> /// Create/Get Data Store for IPersistent typed Key and "Simple typed" Value. /// NOTE: Simple type means one of the integer, numeric(decimals,...), char data types, byte array /// or a string /// </summary> /// <typeparam name="TKey"></typeparam> /// <typeparam name="TValue"></typeparam> /// <param name="createIfNotExist"></param> /// <param name="container"></param> /// <param name="comparer"></param> /// <param name="name"></param> /// <param name="isDataInKeySegment"> </param> /// <param name="mruManaged"> </param> /// <returns></returns> public ISortedDictionary <TKey, TValue> GetPersistentKey <TKey, TValue>(object container, string name, System.Collections.Generic.IComparer <TKey> comparer = null, bool createIfNotExist = true, bool isDataInKeySegment = true, bool mruManaged = true, bool isUnique = false) where TKey : IPersistent, new() { BTreeAlgorithm.CurrentOnValueUnpack = PersistentTypeKeySimpleValue <TKey, TValue> .Collection_OnKeyUnpack; var resolvedContainer = GetContainer(container); var r2 = CreateDictionary <PersistentTypeKeySimpleValue <TKey, TValue>, TKey, TValue>(createIfNotExist, resolvedContainer, name, containerDod => { var r = new PersistentTypeKeySimpleValue <TKey, TValue >( resolvedContainer, comparer, name, DataStoreType . SopOndisk, null, isDataInKeySegment); containerDod. SetCurrentValueInMemoryData (r); return(r); }, mruManaged, isUnique); BTreeAlgorithm.CurrentOnValueUnpack = null; return(r2); }