Exemplo n.º 1
0
        private static bool AreSameMetadata(MetadataModel source, MetadataModel target)
        {
            if (source == null && target == null)
            {
                return(true);
            }

            if (source == null || target == null || source.Count != target.Count)
            {
                return(false);
            }

            if (source.Any(entity => target.Count(c => c.Key == entity.Key) != 1))
            {
                return(false);
            }

            return(source.All(sourceData =>
            {
                var sourceDataItems = sourceData.Value;
                var targetDataItems = target[sourceData.Key];

                return sourceDataItems.Count == targetDataItems.Count &&
                sourceDataItems.All(sourceDataItem => targetDataItems.Count(targetDataItem => AreSameDataItems(sourceDataItem, targetDataItem)) == 1);
            }));
        }