public CodeGenerator(
     ContentTypeConfiguration contentTypeConfiguration, 
     IDataTypeProvider dataTypeProvider, 
     CodeGeneratorFactory factory)
 {
     this.contentTypeConfiguration = contentTypeConfiguration;
     this.dataTypeProvider = dataTypeProvider;
     this.factory = factory;
 }
 public ModelGenerator(
     CodeGeneratorConfiguration configuration, 
     CodeGeneratorFactory generatorFactory, 
     CodeGeneratorFactory interfaceGeneratorFactory,
     UmbracoDataTypesProvider dataTypeProvider, 
     IDictionary<string, string> paths)
 {
     this.configuration = configuration;
     this.generatorFactory = generatorFactory;
     this.interfaceGeneratorFactory = interfaceGeneratorFactory;
     this.dataTypeProvider = dataTypeProvider;
     this.paths = paths;
 }
        private void GenerateModel(ContentType contentType, CodeGeneratorFactory specificGeneratorFactory, Func<ContentType, string> fileNameGetter)
        {
            var typeConfig = contentType is DocumentType
                ? configuration.DocumentTypes
                : configuration.MediaTypes;

            if (!typeConfig.GenerateClasses)
                return;

            var itemStart = DateTime.Now;

            LogHelper.Debug<CodeGenerator>(
                () => String.Format("Content type {0} saved, generating typed model", contentType.Name));
            LogHelper.Info<CodeGenerator>(() => String.Format("Generating typed model for {0}", contentType.Alias));

            var modelPath = EnsureModelPath(typeConfig);
            var path = GetPath(modelPath, fileNameGetter(contentType));
            RemoveReadonly(path);

            var classGenerator = new CodeGenerator(typeConfig, dataTypeProvider, specificGeneratorFactory);
            using (var stream = System.IO.File.CreateText(path))
                classGenerator.Generate(contentType, stream);

            LogHelper.Debug<CodeGenerator>(
                () => String.Format("Typed model for {0} generated. Took {1}", contentType.Alias, DateTime.Now - itemStart));
        }