private static void AddAttributeesFromAttributesContainerToLinkObject(IAttributesContainer attributesContainer, JObject linkObject) { var onlyInAttributes = attributesContainer.Attributes.Where( a => !attributesContainer.Parameters.ContainsKey(a.Key)) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); var onlyInParameters = attributesContainer.Parameters.Where( a => !attributesContainer.Attributes.ContainsKey(a.Key)) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); var inBoth = attributesContainer.Attributes.Where(a => attributesContainer.Parameters.ContainsKey(a.Key)) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); AddAttributesFromAttributesDictionaryToLinkObject(onlyInAttributes, linkObject); AddAttributesFromAttributesDictionaryToLinkObject(onlyInParameters, linkObject, "href"); AddAttributesFromAttributesDictionaryToLinkObject(inBoth, linkObject, "either"); }
private static void SetAttributesAndParametersOnAttributesContainer(JToken dataToken, IAttributesContainer transition) { if (dataToken == null) { return; } var noScopeSet = GetAttributesDictionaryFromDataToken(dataToken, null); var hrefScopeSet = GetAttributesDictionaryFromDataToken(dataToken, "href"); var eitherScopeSet = GetAttributesDictionaryFromDataToken(dataToken, "either"); transition.Attributes = noScopeSet.MergeLeft(eitherScopeSet); transition.Parameters = hrefScopeSet.MergeLeft(eitherScopeSet); }