private UnionLayout CreateSubkontoLayout()
        {
            if (subkontoTypes == null)
            {
                var configurationName = new ConfigurationName(ConfigurationScope.ПланыВидовХарактеристик,
                                                              "ВидыСубконтоХозрасчетные");
                var characteristicsPlan = globalContext.FindMetaByName(configurationName);
                var propertyTypes       = GetConfigurationTypes(characteristicsPlan.ComObject);
                if (propertyTypes == null)
                {
                    throw new InvalidOperationException("can't get characteristics types");
                }
                subkontoTypes = propertyTypes
                                .Where(delegate(string s)
                {
                    var name = ConfigurationName.Parse(s);
                    return(name.Scope == ConfigurationScope.Справочники ||
                           name.Scope == ConfigurationScope.Документы);
                })
                                .ToArray();
            }

            return(new UnionLayout("_Value_TYPE",
                                   "_Value_RTRef",
                                   "_Value_RRRef",
                                   subkontoTypes));
        }
Exemplo n.º 2
0
        public IEnumerable <string> Generate()
        {
            var generationContext = new GenerationContext(targetDirectory);

            foreach (var itemName in itemNames)
            {
                var item = globalContext.FindMetaByName(ConfigurationName.Parse(itemName));
                generationContext.EnqueueIfNeeded(item);
            }
            EmitConstants(generationContext);
            var processedCount = 0;

            while (generationContext.ItemsToProcess.Count > 0)
            {
                var item = generationContext.ItemsToProcess.Dequeue();
                switch (item.Name.Scope)
                {
                case ConfigurationScope.Справочники:
                case ConfigurationScope.Документы:
                case ConfigurationScope.егистрыСведений:
                case ConfigurationScope.ПланыСчетов:
                case ConfigurationScope.ПланыВидовХарактеристик:
                    GenerateClass(item, generationContext);
                    break;

                case ConfigurationScope.Перечисления:
                    EmitEnum(item, generationContext);
                    break;

                default:
                    const string messageFormat = "unexpected scope for [{0}]";
                    throw new InvalidOperationException(string.Format(messageFormat, item.Name));
                }
                processedCount++;
                if (processedCount % 10 == 0)
                {
                    Console.Out.WriteLine("[{0}] items processed, queue length [{1}]",
                                          processedCount, generationContext.ItemsToProcess.Count);
                }
            }
            return(generationContext.GetWrittenFiles());
        }