Beispiel #1
0
        public async Task <TEntity> GetEntityAsync(Guid id)
        {
            if (!Readable())
            {
                throw new NotSupportedException("Service doesn't support.");
            }
            bool    timeout;
            TEntity entity = _Cache.GetEntity(id, out timeout);

            if (entity != null)
            {
                if (timeout)
                {
                    ReloadAsync(id).Start();
                }
                return(entity);
            }
            else
            {
                entity = ServiceEntityProxyBuilder.CreateEntityProxy <TEntity>();
            }
            var values = await GetEntityCoreAsync(id);

            if (values == null)
            {
                return(null);
            }
            MapToEntity(entity, values);
            return(entity);
        }
Beispiel #2
0
 public TEntity Create()
 {
     return(ServiceEntityProxyBuilder.CreateEntityProxy <TEntity>());
 }