Getting started with the Maestro API
Required Knowledge Before you get started with the Maestro API, it helps to have an understanding of the following: Programming in C# and/or the .net Framework. Most of the code examples illustrated here are in C# Understanding the basics of MapGuide development and/or the MapGuide API. The Maestro API supplements MapGuide as an additional development option and carries many of the same concepts used in the official MapGuide API
Why use the Maestro API? As mentioned above, the Maestro API is an alternative option for MapGuide application development. Depending on your needs, the Maestro API may either complement the official MapGuide API or be a wholesale replacement. The Maestro API may be of interest to you if: You prefer to work with MapGuide resources as strongly-typed objects instead of raw XML content You require a strongly-typed service client interface to the http mapagent You would like to build MapGuide applications/libraries that can work on both client and web tiers You would like to build MapGuide applications/libraries that can easily integrate with the respective .net web (asp.net) and desktop (WinForms/WPF) platforms
Supported versions of .net Framework / Visual Studio To use the Maestro API in your project, your application must target the .net Framework 2.0 or higher. You can use any version (and any edition) of Visual Studio that supports targeting the .net Framework 2.0 or higher.
Visual Studio project setup To use the Maestro API in your project, simply reference the OSGeo.MapGuide.MaestroAPI assembly from the SDK. Also ensure that the ConnectionProviders.xml file is also copied to your application's output directory. If you want to use certain connection providers in your application, make sure the provider assemblies are registered in ConnectionProviders.xml and that the provider assemblies are also in your output directory.
Setting up extended model support The Maestro API understands and supports all known schema versions of every resource. If your application only references the OSGeo.MapGuide.MaestroAPI assembly, it will only recognise v1.0.0 resources. Newer versions will return an T:OSGeo.MapGuide.ObjectModels.UntypedResource if you are to retrieve a resource via M:OSGeo.MapGuide.MaestroAPI.Services.IResourceService.GetResource(System.String). Such objects are basically arbitrary containers of XML content. For your application to recognise all supported resource schema versions, and to have the above APIs return strongly typed objects, you will need to also reference the OSGeo.MapGuide.ExtendedObjectModels assembly and have all OSGeo.MapGuide.ObjectModels.* assemblies copied to your application's output directory (which referencing the ExtendedObjectModels assembly should automatically do) Then in your application's entry point, add the following line of code: ModelSetup.Initialize(); This line of code will automatically register the additional schema versions with the Maestro API. For an ASP.net application, you can use the Application_Start() entry point in Global.asax to add this line of code. For ASP.net MVC and other .net-based web frameworks, look for a similar initialization entry point to insert this line of code.