Example #1
0
        private static void EnrichAndCompareWithDatabasePrivate(IMetadataService metadataService, ApplicationObject metaObject)
        {
            ShowProperties(metaObject);
            metadataService.EnrichFromDatabase(metaObject);
            ShowProperties(metaObject);

            List <string> delete, insert;
            bool          result = metadataService.CompareWithDatabase(metaObject, out delete, out insert);

            Console.WriteLine("Сравнение с БД прошло " + (result ? "успешно." : "с ошибками."));
            Console.WriteLine();
            if (delete.Count > 0)
            {
                ShowList("Delete list", delete);
            }
            if (insert.Count > 0)
            {
                ShowList("Insert list", insert);
            }

            Assert.IsTrue(result);
        }
Example #2
0
        private static MessageProducerSettings CreateProducerSettings(InfoBase infoBase, IMetadataService metadataService)
        {
            MessageProducerSettings settings = new MessageProducerSettings();

            MetadataObject metaObject = infoBase.InformationRegisters.Values.Where(с => с.Name == PRODUCER_TABLE_QUEUE_NAME).FirstOrDefault();

            if (metaObject == null)
            {
                return(settings);
            }

            metadataService.EnrichFromDatabase(metaObject);

            settings.DatabaseSettings = new Producer.DatabaseSettings()
            {
                DatabaseProvider = metadataService.DatabaseProvider,
                ConnectionString = metadataService.ConnectionString,
                DatabaseQueue    = new Producer.DatabaseQueue()
                {
                    TableName  = metaObject.TableName,
                    ObjectName = string.Format("{0}.{1}", METAOBJECT_BASE_NAME, PRODUCER_TABLE_QUEUE_NAME)
                }
            };
            foreach (MetadataProperty property in metaObject.Properties)
            {
                foreach (DatabaseField field in property.Fields)
                {
                    settings.DatabaseSettings.DatabaseQueue.Fields.Add(new Producer.TableField()
                    {
                        Name     = field.Name,
                        Property = property.Name
                    });
                }
            }

            return(settings);
        }