public void GetDataTypes_ReturnsTypesFromDiskConfig()
		{
			var provider = new USyncDataTypeProvider(Path.Combine(Environment.CurrentDirectory, @"..\..\uSync"));
			var dataTypes = provider.GetDataTypes().ToList();
			Assert.AreNotEqual(0, dataTypes.Count());
			Assert.IsNotNullOrEmpty(dataTypes.First().DataTypeName);
			Assert.AreNotEqual(Guid.Empty, dataTypes.First().DataTypeId);
			Assert.AreNotEqual(Guid.Empty, dataTypes.First().DefinitionId);
		}
Пример #2
0
        private static void LoadDataTypes()
        {
            dataTypesProvider = new USyncDataTypeProvider(USync.USyncFolder);

            dataTypeDefinitions = DataTypesProvider.GetDataTypes();
            if (!dataTypeDefinitions.Any())
            {
                LogHelper.Error <CodeGenerator>("Could not find data types in usync folder", new Exception());
                dataTypeDefinitions = null;
            }
        }
Пример #3
0
        private static void LoadDataTypes()
        {
            dataTypesProvider = new USyncDataTypeProvider(USync.USyncFolder);

            dataTypeDefinitions = DataTypesProvider.GetDataTypes();
            if (!dataTypeDefinitions.Any())
            {
                LogHelper.Error<CodeGenerator>("Could not find data types in usync folder", new Exception());
                dataTypeDefinitions = null;
            }
        }
		public void GetDataTypes_ReturnsTypesFromDiskConfig()
		{
			var provider = new USyncDataTypeProvider(@"..\..\uSync");
			var dataTypes = provider.GetDataTypes().ToList();
			Assert.AreNotEqual(0, dataTypes.Count());
			Assert.IsNotNullOrEmpty(dataTypes.First().DataTypeName);
			Assert.AreNotEqual(String.Empty, dataTypes.First().DataTypeId);
			Assert.AreNotEqual(Guid.Empty, dataTypes.First().DefinitionId);
            foreach (var type in provider.GetDataTypes())
            {
                Console.WriteLine("{0,-25}{1,-30}{2,-20}", type.DataTypeName, type.DataTypeId, type.DefinitionId);
            }
        }
Пример #5
0
        public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            try
            {
                var uSyncConfigurationProvider = new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"), new HttpContextPathResolver());
                var configurationProvider      = new CodeGeneratorConfigurationFileProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

                uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();

                dataTypesProvider = new USyncDataTypeProvider(uSyncConfiguration.USyncFolder);

                dataTypes     = dataTypesProvider.GetDataTypes();
                configuration = configurationProvider.GetConfiguration();

                generatorFactory = CreateFactory <CodeGeneratorFactory>(configuration.GeneratorFactory);
                parserFactory    = CreateFactory <ParserFactory>(configuration.ParserFactory);

                paths.Add("DocumentType", HttpContext.Current.Server.MapPath(configuration.DocumentTypes.ModelPath));
                paths.Add("MediaType", HttpContext.Current.Server.MapPath(configuration.MediaTypes.ModelPath));

                XmlDoc.Saved += OnDocumentTypeSaved;

                if (configuration.DocumentTypes.GenerateXml)
                {
                    globalStart = DateTime.Now;
                    LogHelper.Info <CodeGenerator>(() => "Parsing typed documenttype models");
                    GenerateXml(configuration.DocumentTypes);
                    LogHelper.Info <CodeGenerator>(() => String.Format("Parsing typed documenttype models done. Took {0:MM\\:ss}", DateTime.Now - globalStart));
                }
                if (configuration.MediaTypes.GenerateXml)
                {
                    globalStart = DateTime.Now;
                    LogHelper.Info <CodeGenerator>(() => "Parsing typed mediatype models");
                    GenerateXml(configuration.MediaTypes);
                    LogHelper.Info <CodeGenerator>(() => String.Format("Parsing typed mediatype models done. Took {0:MM\\:ss}", DateTime.Now - globalStart));
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error <CodeGenerator>("Parsing typed models failed", ex);
            }
        }
Пример #6
0
		public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
		{
			var uSyncConfigurationProvider = new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"), new HttpContextPathResolver());
			var configurationProvider = new CodeGeneratorConfigurationFileProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

			uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();
			
			dataTypesProvider = new USyncDataTypeProvider(uSyncConfiguration.USyncFolder);
	
			dataTypes = dataTypesProvider.GetDataTypes();
			configuration = configurationProvider.GetConfiguration();

			paths.Add("DocumentType", HttpContext.Current.Server.MapPath(configuration.DocumentTypes.ModelPath));
			paths.Add("MediaType", HttpContext.Current.Server.MapPath(configuration.MediaTypes.ModelPath));

			XmlDoc.Saved += OnDocumentTypeSaved;

			if (configuration.DocumentTypes.GenerateXml)
				GenerateXml(configuration.DocumentTypes);
			if (configuration.MediaTypes.GenerateXml)
				GenerateXml(configuration.MediaTypes);
		}