@@ -20,7 +20,7 @@ internal class DocAnnotationWriter : ApiDoctor.Publishing.CSDL.CsdlWriter
2020
2121 private readonly CsdlWriterOptions options ;
2222
23- internal DocAnnotationWriter ( DocSet docSet , CsdlWriterOptions options , string csdl ) : base ( docSet , options )
23+ internal DocAnnotationWriter ( DocSet docSet , CsdlWriterOptions options ) : base ( docSet , options )
2424 {
2525 this . options = options ; // Can change the base access modifier so we could use it.
2626 }
@@ -77,21 +77,31 @@ internal static class AnnotationHelper
7777 {
7878 private static Logger Logger => LogManager . GetLogger ( "AnnotationHelper" ) ;
7979
80- internal async static Task < string > ApplyAnnotationsToCsdl ( string csdl , Options options )
80+ /// <summary>
81+ /// Applies annotations to CSDL file.
82+ /// </summary>
83+ /// <param name="options">The typewriter input options.</param>
84+ /// <param name="pathToCleanMetadata">Optional. Contains the path to a clean metadata to use when applying annotations. Overrides Option.Metadata.</param>
85+ /// <returns>An annotated metadata file.</returns>
86+ internal async static Task < string > ApplyAnnotationsToCsdl ( Options options , string pathToCleanMetadata = null )
8187 {
82- // Get DocSet
8388 DocSet docs = GetDocSet ( options , new IssueLogger ( ) ) ;
8489
8590 var csdlWriterOptions = new CsdlWriterOptions ( )
8691 {
8792 DocumentationSetPath = options . DocsRoot + "\\ api-reference\\ v1.0\\ " ,
8893 Annotations = AnnotationOptions . Properties ,
89- SourceMetadataPath = options . Metadata ,
9094 SkipMetadataGeneration = true ,
9195 Formats = MetadataFormat . EdmxInput
9296 } ;
9397
94- DocAnnotationWriter docWriter = new DocAnnotationWriter ( docs , csdlWriterOptions , csdl ) ;
98+ // We only intend to ues the source metadata when we don't pass in a CSDL.
99+ if ( string . IsNullOrEmpty ( pathToCleanMetadata ) )
100+ csdlWriterOptions . SourceMetadataPath = options . Metadata ;
101+ else
102+ csdlWriterOptions . SourceMetadataPath = pathToCleanMetadata ;
103+
104+ DocAnnotationWriter docWriter = new DocAnnotationWriter ( docs , csdlWriterOptions ) ;
95105
96106 return await docWriter . PublishToStringAsync ( new IssueLogger ( ) ) ;
97107 }
0 commit comments