private static IRelationType DtoToEntity(RelationTypeDto dto)
    {
        IRelationType entity = RelationTypeFactory.BuildEntity(dto);

        // reset dirty initial properties (U4-1946)
        ((BeingDirtyBase)entity).ResetDirtyProperties(false);

        return(entity);
    }
        protected override void PersistUpdatedItem(IRelationType entity)
        {
            ((EntityBase)entity).UpdatingEntity();

            var dto = RelationTypeFactory.BuildDto(entity);

            Database.Update(dto);

            entity.ResetDirtyProperties();
        }
示例#3
0
        private static IRelationType DtoToEntity(RelationTypeDto dto, RelationTypeFactory factory)
        {
            var entity = factory.BuildEntity(dto);

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

            return(entity);
        }
示例#4
0
        protected override void PersistUpdatedItem(RelationType entity)
        {
            entity.UpdatingEntity();

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

            Database.Update(dto);

            entity.ResetDirtyProperties();
        }
示例#5
0
        protected override IEnumerable <IRelationType> PerformGetByQuery(IQuery <IRelationType> query)
        {
            var sqlClause  = GetBaseQuery(false);
            var translator = new SqlTranslator <IRelationType>(sqlClause, query);
            var sql        = translator.Translate();

            var dtos    = Database.Fetch <RelationTypeDto>(sql);
            var factory = new RelationTypeFactory();

            return(dtos.Select(x => DtoToEntity(x, factory)));
        }
    protected override void PersistUpdatedItem(IRelationType entity)
    {
        entity.UpdatingEntity();

        CheckNullObjectTypeValues(entity);

        RelationTypeDto dto = RelationTypeFactory.BuildDto(entity);

        Database.Update(dto);

        entity.ResetDirtyProperties();
    }
        protected override void PersistNewItem(IRelationType entity)
        {
            ((EntityBase)entity).AddingEntity();

            var dto = RelationTypeFactory.BuildDto(entity);

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

            entity.Id = id;

            entity.ResetDirtyProperties();
        }
    protected override void PersistNewItem(IRelationType entity)
    {
        entity.AddingEntity();

        CheckNullObjectTypeValues(entity);

        RelationTypeDto dto = RelationTypeFactory.BuildDto(entity);

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

        entity.Id = id;

        entity.ResetDirtyProperties();
    }
示例#9
0
        protected override IEnumerable <IRelationType> PerformGetAll(params int[] ids)
        {
            var sql = GetBaseQuery(false);

            // should not happen due to the cache policy
            if (ids.Any())
            {
                throw new NotImplementedException();
            }

            var dtos    = Database.Fetch <RelationTypeDto>(sql);
            var factory = new RelationTypeFactory();

            return(dtos.Select(x => DtoToEntity(x, factory)));
        }
示例#10
0
        protected override RelationType PerformGet(int id)
        {
            var sql = GetBaseQuery(false);

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

            var dto = Database.FirstOrDefault <RelationTypeDto>(sql);

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

            var factory = new RelationTypeFactory();
            var entity  = factory.BuildEntity(dto);

            entity.ResetDirtyProperties();

            return(entity);
        }
示例#11
0
        protected override RelationType PerformGet(int id)
        {
            var sql = GetBaseQuery(false);

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

            var dto = Database.FirstOrDefault <RelationTypeDto>(sql);

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

            var factory = new RelationTypeFactory();
            var entity  = factory.BuildEntity(dto);

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

            return(entity);
        }