예제 #1
0
        public override void OnBeforeStart()
        {
            _log.Info("Creating the document storage started.");

            var documentTypes = _metadataApi.GetMetadataItemNames("Documents");

            foreach (var documentType in documentTypes)
            {
                var documentMetadata = new DocumentMetadata {
                    Type = documentType
                };

                var documentIndexes = _metadataApi.GetDocumentIndexes(documentType);

                if (documentIndexes != null)
                {
                    documentMetadata.Indexes = documentIndexes.Select(i => _jsonObjectSerializer.ConvertFromDynamic <DocumentIndex>(i)).ToArray();
                }

                // Специально для Mono пришлось выполнять создание коллекций в последовательном режиме
                AsyncHelper.RunSync(() => CreateStorageAsync(documentMetadata));
            }

            _log.Info("Creating the document storage successfully completed.");
        }