Exemplo n.º 1
0
        public static IRelationType BuildEntity(RelationTypeDto dto)
        {
            var entity = new RelationType(dto.Name, dto.Alias, dto.Dual, dto.ParentObjectType, dto.ChildObjectType);

            try
            {
                entity.DisableChangeTracking();

                entity.Id  = dto.Id;
                entity.Key = dto.UniqueId;

                // reset dirty initial properties (U4-1946)
                entity.ResetDirtyProperties(false);
                return(entity);
            }
            finally
            {
                entity.EnableChangeTracking();
            }
        }
        public IRelationType BuildEntity(RelationTypeDto dto)
        {
            var entity = new RelationType(dto.ChildObjectType, dto.ParentObjectType, dto.Alias);

            try
            {
                entity.DisableChangeTracking();

                entity.Id              = dto.Id;
                entity.Key             = dto.UniqueId;
                entity.IsBidirectional = dto.Dual;
                entity.Name            = dto.Name;

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