Skip to content

Commit

Permalink
Revert "Make temp file metadata default" (#55)
Browse files Browse the repository at this point in the history
* Revert "Make temp file metadata default (#46)"

This reverts commit f44dd5b.

* Restore fix for custom headers

* Bump up OCS version to 0.6.1

Co-authored-by: John Gathogo <[email protected]>
  • Loading branch information
gathogojr and gathogojr authored Mar 23, 2020
1 parent a52fbdd commit 39a43e3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
15 changes: 2 additions & 13 deletions src/CodeGeneration/V4CodeGenDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private async Task AddT4FileAsync()
{
string tempFile = Path.GetTempFileName();
string t4Folder = Path.Combine(this.CurrentAssemblyPath, "Templates");
const string CsdlFileName = "Csdl.xml";

using (StreamWriter writer = File.CreateText(tempFile))
{
Expand All @@ -73,20 +72,13 @@ private async Task AddT4FileAsync()
text = Regex.Replace(text, "(public const bool EnableNamingAlias = )true;", "$1" + this.ServiceConfiguration.EnableNamingAlias.ToString().ToLower(CultureInfo.InvariantCulture) + ";");
text = Regex.Replace(text, "(public const bool IgnoreUnexpectedElementsAndAttributes = )true;", "$1" + this.ServiceConfiguration.IgnoreUnexpectedElementsAndAttributes.ToString().ToLower(CultureInfo.InvariantCulture) + ";");
text = Regex.Replace(text, "(public const bool MakeTypesInternal = )false;", "$1" + ServiceConfiguration.MakeTypesInternal.ToString().ToLower(CultureInfo.InvariantCulture) + ";");
string customHeaders = "";
if(ServiceConfiguration.CustomHttpHeaders != null)
{
customHeaders = ServiceConfiguration.CustomHttpHeaders;
}
string customHeaders = ServiceConfiguration.CustomHttpHeaders ?? "";
text = Regex.Replace(text, "(public const string CustomHttpHeaders = )\"\";", "$1@\"" + customHeaders + "\";");
text = Regex.Replace(text, "(public const string TempFilePath = )\"\";", "$1\"" + CsdlFileName + "\";");
await writer.WriteAsync(text);
await writer.FlushAsync();
}

string referenceFolder = GetReferenceFileFolder();
string tempMetadataFile = Path.Combine(referenceFolder, CsdlFileName);
await this.Context.HandlerHelper.AddFileAsync(tempFile, tempMetadataFile);
await this.Context.HandlerHelper.AddFileAsync(Path.Combine(t4Folder, "ODataT4CodeGenerator.ttinclude"), Path.Combine(referenceFolder, this.GeneratedFileNamePrefix + ".ttinclude"));
await this.Context.HandlerHelper.AddFileAsync(Path.Combine(t4Folder, "ODataT4CodeGenFilesManager.ttinclude"), Path.Combine(referenceFolder, "ODataT4CodeGenFilesManager.ttinclude"));
await this.Context.HandlerHelper.AddFileAsync(tempFile, Path.Combine(referenceFolder, this.GeneratedFileNamePrefix + ".tt"));
Expand Down Expand Up @@ -115,11 +107,8 @@ private async Task AddGeneratedCSharpCodeAsync()
}
}
t4CodeGenerator.CustomHttpHeaders = headers;

string tempFile = Path.GetTempFileName();
const string CsdlFileName = "Csdl.xml";
string tempMetadataFile = Path.Combine(GetReferenceFileFolder(), CsdlFileName);
await this.Context.HandlerHelper.AddFileAsync(tempFile, tempMetadataFile);
t4CodeGenerator.TempFilePath = CsdlFileName;

using (StreamWriter writer = File.CreateText(tempFile))
{
Expand Down
2 changes: 1 addition & 1 deletion src/ODataConnectedServiceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ODataConnectedServiceProvider()
Description = "OData Connected Service for V1-V4";
Icon = new BitmapImage(new Uri("pack://application:,,/" + this.GetType().Assembly.ToString() + ";component/Resources/Icon.png"));
CreatedBy = "OData";
Version = new Version(0, 6, 0);
Version = new Version(0, 6, 1);
MoreInfoUri = new Uri("https://github.com/odata/ODataConnectedService");
}

Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
[assembly: AssemblyVersion("0.6.1.0")]
[assembly: AssemblyFileVersion("0.6.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

[assembly: InternalsVisibleTo("ODataConnectedService.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
2 changes: 1 addition & 1 deletion src/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="ODataConnectedService.e30335d6-f9c7-4d08-b66a-f011f3f18477" Version="0.6.0" Language="en-US" Publisher="Microsoft" />
<Identity Id="ODataConnectedService.e30335d6-f9c7-4d08-b66a-f011f3f18477" Version="0.6.1" Language="en-US" Publisher="Microsoft" />
<Author>Microsoft</Author>
<DisplayName>OData Connected Service</DisplayName>
<Description xml:space="preserve">OData Connected Service for V1-V4</Description>
Expand Down

0 comments on commit 39a43e3

Please sign in to comment.