GetObjectForType() public static method

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

            Conflict conflict;

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

            return(conflict);
        }
Example #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)XNode.ReadFrom(reader));

            liveEntity = ReflectionUtility.GetObjectForType(currentEntryWrapper, this.knownTypes);
            return(liveEntity);
        }