Beispiel #1
0
        internal ICollection <EntityMetadata> InitializeEntityMetadata(IEnumerable <EntityMetadata> sourceEntities,
                                                                       Stream streamValidator = null)
        {
            var resultEntities = new HashSet <EntityMetadata>();

            IReadOnlyCollection <EntityMetadata> clientEntities;

            using (var stream = MetadataParsingUtils.GetStreamImpl(Metadata, false, streamValidator)) {
                var parsingResult = new XmlEntitySourceMetadataParser().Parse(stream);
                clientEntities = parsingResult.Item1;
                Queries        = parsingResult.Item2;
            }
            foreach (var sourceEntity in sourceEntities)
            {
                var overridenEntity = clientEntities.FirstOrDefault(a => a.Name == sourceEntity.Name);
                if (overridenEntity != null)
                {
                    MergeEntities(sourceEntity, overridenEntity);
                }
                resultEntities.Add(sourceEntity);
            }

            foreach (var clientEntity in clientEntities)
            {
                resultEntities.Add(clientEntity);
            }


            return(resultEntities);
        }
Beispiel #2
0
 internal MetadataProperties Initialize(Stream streamValidator = null)
 {
     using (var stream = MetadataParsingUtils.GetStream(streamValidator, Properties)) {
         var metadata = new XmlPropertyMetadataParser().Parse(stream);
         metadata.ValidateRequiredProperties();
         return(metadata);
     }
 }
 internal MenuDefinition InitializeMenu(ClientPlatform platform, Stream streamValidator = null)
 {
     try {
         using (var stream = MetadataParsingUtils.GetStream(streamValidator, String.Format(MenuPattern, platform.ToString().ToLower()))) {
             return(stream == null ? null : new XmlMenuMetadataParser().Parse(stream));
         }
     } catch (Exception) {
         Log.Warn(String.Format("menu.{0}.xml not found", platform));
     }
     return(null);
 }
Beispiel #4
0
        internal static IReadOnlyCollection <CompleteApplicationMetadataDefinition> InitializeApplicationMetadata([NotNull] IEnumerable <EntityMetadata> entityMetadata, Stream streamValidator = null)
        {
            if (entityMetadata == null)
            {
                throw new ArgumentNullException("entityMetadata");
            }
            var applicationMetadata = new List <CompleteApplicationMetadataDefinition>();
            var parser = new XmlApplicationMetadataParser(entityMetadata);

            using (var stream = MetadataParsingUtils.GetStream(streamValidator, Metadata)) {
                applicationMetadata.AddRange(parser.Parse(stream));
            }
            return(applicationMetadata);
        }
 public void Validate(Stream data = null)
 {
     try {
         var internalTargets = new XmlEntityTargetMetadataParser().Parse(MetadataParsingUtils.GetInternalStreamImpl(false, data));
         try {
             var streamReader = MetadataParsingUtils.GetStreamImpl(Target, false, data);
             if (streamReader != null)
             {
                 var targets = new XmlEntityTargetMetadataParser().Parse(streamReader);
                 MergeTargets(internalTargets, targets);
             }
         } catch (IOException e) {
             //file not found, ok
         }
         MergeEntities(internalTargets);
     } catch (Exception e) {
         Log.Error("error validating metadata", e);
         throw;
     }
 }
 internal static string GetMenuPath(ClientPlatform platform)
 {
     return(MetadataParsingUtils.GetPath(String.Format(MenuPattern, platform.ToString().ToLower())));
 }
Beispiel #7
0
 internal static IReadOnlyCollection <EntityMetadata> InitializeEntityInternalMetadata()
 {
     using (var stream = MetadataParsingUtils.GetInternalStreamImpl(true)) {
         return(new XmlEntitySourceMetadataParser().Parse(stream).Item1);
     }
 }