GetObjectForType() public static méthode

public static GetObjectForType ( EntryInfoWrapper wrapper, Type knownTypes ) : IOfflineEntity
wrapper EntryInfoWrapper
knownTypes System.Type
Résultat IOfflineEntity
Exemple #1
0
        /// <summary>
        /// Get the conflict item
        /// </summary>
        /// <returns>Conflict item</returns>
        public virtual Conflict GetConflict()
        {
            if (!HasConflict())
            {
                return(null);
            }

            Conflict conflict = null;

            if (_currentEntryWrapper.IsConflict)
            {
                conflict = new SyncConflict()
                {
                    LiveEntity   = _liveEntity,
                    LosingEntity = ReflectionUtility.GetObjectForType(_currentEntryWrapper.ConflictWrapper, this._knownTypes),
                    Resolution   = (SyncConflictResolution)Enum.Parse(FormatterConstants.SyncConflictResolutionType, _currentEntryWrapper.ConflictDesc, true)
                };
            }
            else
            {
                conflict = new SyncError()
                {
                    LiveEntity  = _liveEntity,
                    ErrorEntity = ReflectionUtility.GetObjectForType(_currentEntryWrapper.ConflictWrapper, this._knownTypes),
                    Description = _currentEntryWrapper.ConflictDesc
                };
            }

            return(conflict);
        }
Exemple #2
0
        /// <summary>
        /// Returns the current entry element casted as an IOfflineEntity element
        /// </summary>
        /// <returns>Typed entry element</returns>
        public override IOfflineEntity GetItem()
        {
            CheckItemType(ReaderItemType.Entry);

            // Get the type name and the list of properties.
            _currentEntryWrapper = new AtomEntryInfoWrapper((XElement)XElement.ReadFrom(_reader));

            _liveEntity = ReflectionUtility.GetObjectForType(_currentEntryWrapper, this._knownTypes);
            return(_liveEntity);
        }