Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ODataLib/EdmLib/MS.Spatial on ASP.NET 5/ASP.NET Core 5 #97

Closed
lewischeng-ms opened this issue Mar 12, 2015 · 12 comments
Closed
Assignees
Milestone

Comments

@lewischeng-ms
Copy link
Contributor

Target: support referencing ODataLib/EdmLib/MS.Spatial NuGet packages from ASP.NET 5 projects.

In ASP.NET 5, there are two profiles to be supported:

  • ASP.NET 5
  • ASP.NET Core 5
@lewischeng-ms
Copy link
Contributor Author

@PinpointTownes Please download preview packages for ASP.NET 5 from https://github.com/lewischeng-ms/vNext/tree/master/packages.

Profile mapping
  • aspnet50 <=> portable40+profile328 (dotnet40 also work perfect)
  • aspnetcore50 <=> portable45+profile259

To resolve the issue 'System.Object' defined in an assembly not imported, just need to add the following content to .nuspec:

<dependencies>
  <group targetFramework="Asp.NetCore5.0">
    <dependency id="System.Runtime" version="4.0.20-beta-22523" />
    <dependency id="Microsoft.Spatial" version="[$VersionNuGetSemantic$]" />
    <dependency id="Microsoft.OData.Edm" version="[$VersionNuGetSemantic$]" />
  </group>
</dependencies>
<frameworkAssemblies>
  <frameworkAssembly assemblyName="mscorlib" targetFramework="Asp.Net5.0" />
  <frameworkAssembly assemblyName="System" targetFramework="Asp.Net5.0" />
  <frameworkAssembly assemblyName="System.Core" targetFramework="Asp.Net5.0" />
  <frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework="Asp.Net5.0" />
</frameworkAssemblies>
Version

Though the version was set to 7.0.0-preview to avoid ambiguity with the existing 6.XX.X packages from nuget.org, they are actually 6.10.0.

Source

https://github.com/lewischeng-ms/odata.net/tree/vNext

Known Issues

ODataLib has TypeInitialization problem under aspnetcore50 (though compilable) but works fine under aspnet50.

@lewischeng-ms
Copy link
Contributor Author

@PinpointTownes Fixed the TypeInitialization problem. It was due to dlls not signed. So I decided to temporarily make them non-transparent assemblies. Now they seemed to work fine under aspnetcore50.

@kevinchalet
Copy link

@lewischeng-ms great, thanks! 👍

I finally ported Web API OData to dnxcore50: https://github.com/PinpointTownes/WebApi/commit/f2fffbc2b32b48179b20865a7e5b0d50a656da4c

Sadly, there's currently a bug in CoreCLR that prevents it from working, but it should be fixed soon 👯

To be honest, I'm not totally happy with all the changes needed to make it work (specially the Type.GetTypeCode replacement), so feel free to review it and tell me what you think (I'm on JabbR).

@lewischeng-ms
Copy link
Contributor Author

@PinpointTownes Yeah, I've already seen your commits and you REALLY did an amazing job! Cheers! And for Type.GetTypeCode, my replacemnt is lewischeng-ms@77c7020. Though I am not totally happy about that solution tooooo.. we are reinventing the wheel, but looks like currently there is no better solution.

@kevinchalet
Copy link

Thanks! 😄

Nice, I'll reuse your PlatformHelper approach: even if it does something similar internally, the resulting code is probably easier to read than a ton of if/elseif.

@lewischeng-ms
Copy link
Contributor Author

Step 1: Clean up macros in PRODUCTION code (#136); rename WINRT to DNXCORE50.

@lewischeng-ms
Copy link
Contributor Author

Step 2: Create Net45 projects for the profile DNX451 and use ApiPort to verify.

ApiPort analysis results:

  • .NET 4.5.1 - 100%
  • .NET 4.6 - 100%

Checked in as efcb348

@lewischeng-ms
Copy link
Contributor Author

Step 3: Create Profile259 (Portable .NET 4.0) projects for the profile DNXCORE50 and use ApiPort to verify.

Reference: NuGetFramework and FrameworkReducer tests

ApiPort analysis results:

  • ASP.NET 5 - 100%

Checked in as b7edcf8

@lewischeng-ms
Copy link
Contributor Author

Step 4: Add Net45 and Profile259 libraries into NuGet packages.

Remarks: Net45 corresponds to the profile net45 in the NuGet packages while Profile259 corresponds to the profile portable-net45+win8+wp8+wpa81+dnxcore50.

Checked in as 11d201c

@lewischeng-ms
Copy link
Contributor Author

Step 5: Update TFS and produce signed packages.

Preview packages updated: https://www.myget.org/feed/Packages/odlpreview

@lewischeng-ms
Copy link
Contributor Author

Step 6: Test & resolve any incompatibility on ASP.NET 5.0

Status: ODataLib/EdmLib/Spatial works well so far
Tested on:

  • an ASP.NET console application including some simple functional tests
  • the Web API for OData vNext prototype and an sample service

@lewischeng-ms
Copy link
Contributor Author

Final commit 84716ac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants