22using ApiDoctor . Validation ;
33using ApiDoctor . Validation . Error ;
44using ApiDoctor . Validation . OData ;
5+ using ApiDoctor . Validation . OData . Transformation ;
56using NLog ;
67using System ;
78using System . Collections . Generic ;
@@ -15,22 +16,25 @@ namespace Typewriter
1516 internal class DocAnnotationWriter : ApiDoctor . Publishing . CSDL . CsdlWriter // or this a helper, will name this later
1617 {
1718 private static Logger Logger => LogManager . GetLogger ( "DocAnnotationWriter" ) ;
18- private string csdl ;
19+ // private string csdl;
1920
2021 internal IssueLogger IssueLogger { get ; set ; }
2122 internal DocSet DocSet { get ; set ; }
23+ internal string Csdl { get ; set ; }
2224
2325 private readonly CsdlWriterOptions options ;
2426
2527 internal DocAnnotationWriter ( DocSet docSet , CsdlWriterOptions options , string csdl ) : base ( docSet , options )
2628 {
27- this . csdl = csdl ;
29+ this . Csdl = csdl ;
2830 this . DocSet = docSet ;
2931 this . options = options ; // Can change the base access modifier so we could use it.
3032 }
3133
32- private async Task < string > PublishToStringAsync ( IssueLogger issues )
34+ public async Task < string > PublishToStringAsync ( IssueLogger issues )
3335 {
36+ string outputFilenameSuffix = "" ;
37+
3438 // Step 1: Generate an EntityFramework OM from the documentation and/or template file
3539 EntityFramework framework = CreateEntityFrameworkFromDocs ( issues ) ;
3640 if ( null == framework )
@@ -72,15 +76,7 @@ private async Task<string> PublishToStringAsync(IssueLogger issues)
7276 }
7377
7478 // Step 2: Generate XML representation of EDMX
75- string xmlData = null ;
76- if ( options . Formats . HasFlag ( MetadataFormat . EdmxOutput ) )
77- {
78- xmlData = ODataParser . Serialize < EntityFramework > ( framework , options . AttributesOnNewLines ) ;
79- }
80- else if ( options . Formats . HasFlag ( MetadataFormat . SchemaOutput ) )
81- {
82- xmlData = ODataParser . Serialize < Schema > ( framework . DataServices . Schemas . First ( ) , options . AttributesOnNewLines ) ;
83- }
79+ string xmlData = ODataParser . Serialize < EntityFramework > ( framework , options . AttributesOnNewLines ) ;
8480
8581 return xmlData ;
8682 }
@@ -90,7 +86,7 @@ internal static class AnnotationHelper
9086 {
9187 private static Logger Logger => LogManager . GetLogger ( "AnnotationHelper" ) ;
9288
93- internal static string ApplyAnnotationsToCsdl ( string csdl , Options options )
89+ internal async static Task < string > ApplyAnnotationsToCsdl ( string csdl , Options options )
9490 {
9591 // Get DocSet
9692 DocSet docs = GetDocSet ( options , new IssueLogger ( ) ) ;
@@ -100,7 +96,7 @@ internal static string ApplyAnnotationsToCsdl(string csdl, Options options)
10096 // Create DocAnnotationWriter
10197 DocAnnotationWriter docWriter = new DocAnnotationWriter ( docs , csdlWriterOptions , csdl ) ;
10298
103- throw new NotImplementedException ( ) ;
99+ return await docWriter . PublishToStringAsync ( new IssueLogger ( ) ) ;
104100 }
105101
106102 private static DocSet GetDocSet ( Options options , IssueLogger issues )
@@ -120,6 +116,7 @@ private static DocSet GetDocSet(Options options, IssueLogger issues)
120116
121117 Logger . Info ( "Scanning documentation files" ) ;
122118 var stopwatch = new Stopwatch ( ) ;
119+ stopwatch . Start ( ) ;
123120 docSet . ScanDocumentation ( string . Empty , issues ) ;
124121 stopwatch . Stop ( ) ;
125122 Logger . Info ( $ "Took { stopwatch . Elapsed } to parse { docSet . Files . Length } source files.") ;
0 commit comments