Esempio n. 1
0
 /// <summary>
 /// Adds the stecified item in the cache.
 /// </summary>
 /// <param name="id">The id of the stored item in the cache.</param>
 /// <param name="item">The item to cache.</param>
 protected void AddInCache(Identifier id, T item)
 {
     if (!InternalCache.ContainsKey(id))
     {
         InternalCache.Add(id, item);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Adds an item to the cache
 /// </summary>
 /// <param name="Key">Key</param>
 /// <param name="Value">Value</param>
 public virtual void Add(KeyType Key, object Value)
 {
     lock (InternalCache)
     {
         if (Exists(Key))
         {
             InternalCache[Key].Value = Value;
         }
         else
         {
             InternalCache.Add(Key, new CacheItem <KeyType>(Key, Value));
         }
     }
 }
Esempio n. 3
0
        protected override AppointmentDto Map(SQLiteDataReader reader)
        {
            var        rid = reader["Id"] as long?;
            Identifier id;

            if (!rid.HasValue)
            {
                throw new NullReferenceException("There's an appointment without ID");
            }
            else
            {
                id = new Identifier(rid.Value);
            }

            if (InternalCache.ContainsKey(id))
            {
                return(InternalCache[id]);
            }
            else
            {
                var item = new AppointmentDto()
                {
                    IsImported = true
                };

                item.StartTime = reader["StartDate"] as DateTime? ?? DateTime.Now;
                item.EndTime   = reader["EndDate"] as DateTime? ?? DateTime.Now;

                item.Subject = reader["Title"] as string;
                item.Notes   = Messages.Msg_DoneByConverter;
                item.User    = PluginContext.Host.ConnectedUser;
                item.Tag     = this.MapTag(reader["fk_MeetingType"] as long?);

                InternalCache.Add(id, item);

                return(item);
            }
        }
Esempio n. 4
0
 /// <inheritdoc />
 public void Add(TMajor item) => InternalCache.Add(item);
Esempio n. 5
0
 /// <inheritdoc />
 public void Add(TMajor record) => InternalCache.Add(record);