public static FileManager Create(object textTransformation) { FileManager result = null; bool inVSNET = false; DynamicTextTransformation transformation = DynamicTextTransformation.Create(textTransformation); IDynamicHost host = transformation.Host; try { #if !PREPROCESSED_TEMPLATE if (host.AsIServiceProvider() != null) { inVSNET = true; } #endif result = inVSNET ? new VSManager(transformation) : new FileManager(transformation); } catch (Exception e) { //host.LogError(e); } return(result); }
/// <summary> /// Creates the VsEntityFrameworkTemplateFileManager if VS is detected, otherwise /// creates the file system version. /// </summary> public static EntityFrameworkTemplateFileManager Create(object textTransformation) { DynamicTextTransformation transformation = DynamicTextTransformation.Create(textTransformation); IDynamicHost host = transformation.Host; #if !PREPROCESSED_TEMPLATE var hostServiceProvider = host.AsIServiceProvider(); if (hostServiceProvider != null) { EnvDTE.DTE dte = (EnvDTE.DTE)hostServiceProvider.GetService(typeof(EnvDTE.DTE)); if (dte != null) { return(new VsEntityFrameworkTemplateFileManager(transformation)); } } #endif return(new EntityFrameworkTemplateFileManager(transformation)); }