public object Put(IdentityDefinition def, object entity, IEntityProperty[] activeProperites)
        {
            EntityCacheTable cache;

            if (!_caches.TryGetValue(def, out cache))
            {
                _caches[def] = cache = new EntityCacheTable(def);
            }

            return(cache.Put(entity, activeProperites));
        }
        public void Update(IdentityDefinition def, IDictionary <IEntityProperty, object> propertyValues)
        {
            EntityCacheTable cache;

            if (!_caches.TryGetValue(def, out cache))
            {
                throw new EntityCacheException(String.Format("No cache is available for the identity definition '{0}'.", def));
            }

            cache.Update(propertyValues);
        }
        /// <summary>
        /// Import another mapping's settings
        /// </summary>
        public Mapping <T> UseMapping(Mapping <T> mapping)
        {
            this.BaseMapping = mapping.BaseMapping;

            if (this.CacheIdentity == null)
            {
                this.CacheIdentity = mapping.CacheIdentity;
            }

            ((List <IMapping>) this.SubMappings).AddRange(mapping.SubMappings);

            return(this);
        }
        public IEnumerable Get(IdentityDefinition identityDefinition)
        {
            EntityCacheTable cache;

            if (!_caches.TryGetValue(identityDefinition, out cache))
            {
                yield break;
            }
            foreach (object entity in cache.Get())
            {
                yield return(entity);
            }
        }
 public Mapping <T> Identity(IdentityDefinition identityDefinition)
 {
     this.CacheIdentity = identityDefinition;
     return(this);
 }
 public EntityCacheTable(IdentityDefinition identityDefinition)
 {
     this.IdentityDefinition = identityDefinition;
 }
 public IEnumerable <T> Get <T>(IdentityDefinition identityDefinition)
 {
     return(Get(identityDefinition).OfType <T>());
 }
 public T Put <T>(IdentityDefinition def, T entity, IEntityProperty[] activeProperites)
 {
     return((T)Put(def, (object)entity, activeProperites));
 }