protected override void PersistUpdatedItem(IServerRegistration entity)
        {
            ((ServerRegistration)entity).UpdatingEntity();

            var dto = ServerRegistrationFactory.BuildDto(entity);

            Database.Update(dto);

            entity.ResetDirtyProperties();
        }
        public void ReloadCache()
        {
            var factory = new ServerRegistrationFactory();
            var all     = Database.Fetch <ServerRegistrationDto>("WHERE id > 0")
                          .Select(x => factory.BuildEntity(x))
                          .Cast <IServerRegistration>()
                          .ToArray();

            _globalCache.ClearCacheItem(CacheKey);
            _globalCache.GetCacheItem(CacheKey, () => all);
        }
Пример #3
0
        protected override void PersistUpdatedItem(ServerRegistration entity)
        {
            ((Entity)entity).UpdatingEntity();

            var factory = new ServerRegistrationFactory();
            var dto     = factory.BuildDto(entity);

            Database.Update(dto);

            ((ICanBeDirty)entity).ResetDirtyProperties();
        }
        protected override void PersistNewItem(IServerRegistration entity)
        {
            ((ServerRegistration)entity).AddingEntity();

            var dto = ServerRegistrationFactory.BuildDto(entity);

            var id = Convert.ToInt32(Database.Insert(dto));

            entity.Id = id;

            entity.ResetDirtyProperties();
        }
Пример #5
0
        protected override ServerRegistration PerformGet(int id)
        {
            var sql = GetBaseQuery(false);

            sql.Where(GetBaseWhereClause(), new { Id = id });

            var serverDto = Database.First <ServerRegistrationDto>(sql);

            if (serverDto == null)
            {
                return(null);
            }

            var factory = new ServerRegistrationFactory();
            var entity  = factory.BuildEntity(serverDto);

            //on initial construction we don't want to have dirty properties tracked
            // http://issues.umbraco.org/issue/U4-1946
            entity.ResetDirtyProperties(false);

            return(entity);
        }
 protected override IEnumerable <IServerRegistration> PerformGetAll(params int[] ids)
 {
     return(Database.Fetch <ServerRegistrationDto>("WHERE id > 0")
            .Select(x => ServerRegistrationFactory.BuildEntity(x)));
 }