wiki:MapGuideRfc68

Version 36 (modified by leaf, 15 years ago) ( diff )

--

MapGuide RFC 68 - Refactoring Web .NET API into Common DLLs

This page contains an change request (RFC) for the MapGuide Open Source project. More MapGuide RFCs can be found on the RFCs page.

Status

RFC Template Version(1.0)
Submission DateJune 23, 2009
Last ModifiedLeaf Li Timestamp
AuthorLeaf Li
RFC Statusadopted
Implementation Statusunder development
Proposed Milestone2.2
Assigned PSC guide(s)Bruce Dechant
Voting HistoryJuly 6, 2009
+1Andy, Bruce, Kenneth, Tom
+0Jason, Paul
-0
-1
no voteBob, Haris

Overview

This proposal is to refactor MapGuide Web .NET API to some common dlls.

Motivation

Currently all MapGuide Web .NET API is in one single dll MapGuieDotNetApi.dll, which includes Foundation, Geometry, PlatformBase, MapGuideCommon, WebApp and HttpHandler components. It is nearly impossible for users to reuse some of functionality outside of MapGuide because MapGuide .NET Web API depends on MapGuide enviroment. For example, users can't use coordinate system transformation functionality outside MapGuide. So the key motivation of this RFC is to make MapGuide Web .NET API more reusable so that more projects or products can get benifits from MapGuide.

Proposed Solution

In order to make backward compatible with the existing MapGuide applications, the old assembly MapGuieDotNetApi.dll still exists. However, it contains some TypeForwardedTo attributes only. TypeForwardedTo attribute allows you to move a type to another assembly without having to recompile applications that use the original assembly. This is the solution that Microsoft recommends to keep backward compatibility of .NET API. You can get more information about TypeForwardedTo attribute from MSDN.

http://msdn.microsoft.com/en-us/library/ms404275.aspx

So the proposed solution is to

(a) Create the following five new assemblies.

  • OSGeo.MapGuide.Foundation.dll: contains API in Foundation component.
  • OSGeo.MapGuide.Geometry.dll: contains API in Geometry compoent.
  • OSGeo.MapGuide.PlatformBase.dll: contains API in PlatformBase component.
  • OSGeo.MapGuide.MapGuideCommon.dll: contains API in MapGuideCommon compoent.
  • OSGeo.MapGuide.Web.dll: contains API in WebApp and HttpHandler components.

(b) Create the following assembly by adding the reference to five assemblies above and some TypeForwardedTo attributes. For example, [assembly: TpeForwardedTo(typeof(OSGeo.MapGuide.MgFeatureService))].

  • MapGuideDotNetApi.dll

Implications

Currently, there is no enough resources and funding to refator PHP and Java API. They may be implemented if resources and funding can be obtained in the future.

Test Plan

Run the existing unit tests. No need to add new unit tests.

Funding/Resources

Supplied by Autodesk.

Addendum, Sept. 08, 2009

Previously, we change the old MapGuide .NET assembly into an assembly with five netmodules. It has the following issues.

  • Generally, the assembly with multiple netmodules is applied to the assembly whose netmodules has no dependencies. In MapGuide, Geometry netmodule depends on Foundation netmodule and PlatformBase netmodule depends on Foundation and Geometry netmodules.
  • If the applications based on MapGuide .NET API want to do some changes to their API and they use TypeForwardedTo attribute to keep backward compatibility of their .NET API, it will not work because there is one bug in .NET framework 2.0. This bug results in TypeForwardedTo functionality doesn't work with assebmly with multiple netmodules. There is no public document for this bug. However, I already got confirmation from Microsoft.
  • The solution that Microsoft recommends to keep backward compatibility of API is to use TypeForwardedTo attribute instead of netmodule.

So we want to use TypeForwardedTo attribute to keep backward compatibility of MapGuide .NET API too. I tied it. I works and resolves all of issues above.

Note: See TracWiki for help on using the wiki.