コード例 #1
0
        private ZipFileResultEntry[] SerializePerTable(SerializationSet serializationSet, DataRequest request)
        {
            var filteredMetaDataList = new List <SerializationSet>();

            foreach (var table in serializationSet.Tables)
            {
                var filteredMetaData = serializationSet.Filter(table.Name);
                filteredMetaData = ReplaceOptionProcessor.Process(filteredMetaData, request);

                if (filteredMetaData.Tables.Any())
                {
                    filteredMetaDataList.Add(filteredMetaData);
                }
            }

            var entries = new List <ZipFileResultEntry>();

            foreach (var dataSet in filteredMetaDataList)
            {
                var filename = $"{dataSet.Tables[0].Name}.{request.Ext}";
                var serializationSetStream = new MemoryStream();
                var serializer             = this.GetDataSerializer(request.OutputType);
                serializer.Serialize(serializationSetStream, dataSet);

                entries.Add(new ZipFileResultEntry(filename, serializationSetStream));
            }

            return(entries.ToArray());
        }
コード例 #2
0
        private SerializationSet GetSerializationSet(string databaseName, DataRequest request)
        {
            var runtimeService = this.cremaHost.GetService(typeof(IRuntimeService)) as IRuntimeService;

            if (runtimeService == null)
            {
                throw new NullReferenceException(nameof(runtimeService));
            }

            var result = runtimeService.GetDataGenerationData(databaseName, request.Tags, request.FilterExpression, request.IsDevMode, request.Revision);

            result.Validate();

            var filteredMetaData = ReplaceOptionProcessor.Process(result.Value, request);

            return(filteredMetaData);
        }