Skip to content

Commit

Permalink
Mimic Composistion behavior for Media Types #106
Browse files Browse the repository at this point in the history
Do the same thing for media types.
  • Loading branch information
KevinJump committed Jan 20, 2017
1 parent 2a5f6c8 commit 17fd9e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Jumoo.uSync.Core/Serializers/ContentTypeSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ private void DeserializeCompositions(IContentType item, XElement node)
LogHelper.Warn<ContentTypeSerializer>("Unable to find type for composition: " + compAlias);
}
}
LogHelper.Debug<ContentTypeSerializer>("Setting {0} compositions for element", () => item.ContentTypeComposition.Count());
item.ContentTypeComposition = compositions;

LogHelper.Debug<ContentTypeSerializer>("Setting {0} compositions for element", () => item.ContentTypeComposition.Count());
}

private XElement SerializeTemplates(IContentType item)
Expand Down
9 changes: 6 additions & 3 deletions Jumoo.uSync.Core/Serializers/MediaTypeSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ private void DeserializeCompositions(IMediaType item, XElement node)
{
var info = node.Element("Info");
var comps = info.Element("Compositions");
List<IContentTypeComposition> compositions = new List<IContentTypeComposition>();
if (comps != null && comps.HasElements)
{
foreach (var composition in comps.Elements("Composition"))
Expand All @@ -221,11 +222,13 @@ private void DeserializeCompositions(IMediaType item, XElement node)
if (type == null)
type = _contentTypeService.GetMediaType(compAlias);
if (type != null)
item.AddContentType(type);
else
LogHelper.Warn<MediaTypeSerializer>("Unable to find type for composition: "+compAlias);
compositions.Add(type);
else
LogHelper.Warn<MediaTypeSerializer>("Unable to find type for composition: " + compAlias);
}
}
LogHelper.Debug<MediaTypeSerializer>("Setting {0} compositions for element", () => item.ContentTypeComposition.Count());
item.ContentTypeComposition = compositions;
}

public override SyncAttempt<IMediaType> DesearlizeSecondPass(IMediaType item, XElement node)
Expand Down

0 comments on commit 17fd9e4

Please sign in to comment.