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;
            }
        }
		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);
            }
        }
		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);
		}