Exemplo n.º 1
0
        /// <inheritdoc />
        protected override ITag PerformGet(int id)
        {
            var sql = Sql().Select <TagDto>().From <TagDto>().Where <TagDto>(x => x.Id == id);
            var dto = Database.Fetch <TagDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();

            return(dto == null ? null : TagFactory.BuildEntity(dto));
        }
Exemplo n.º 2
0
        protected override ITag PerformGet(int id)
        {
            var sql = GetBaseQuery(false);

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

            var tagDto = Database.Fetch <TagDto>(sql).FirstOrDefault();

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

            var factory = new TagFactory();
            var entity  = factory.BuildEntity(tagDto);

            //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);
        }