Skip to content

Migration Guide from FubuMVC 1 to 2.2

Jeremy D. Miller edited this page Dec 16, 2015 · 1 revision

Assembly/Nuget Merging

The following assemblies were merged into FubuMVC.Core:

  • FubuMVC.Core.UI
  • FubuMVC.Core.Views
  • FubuMVC.Json & FubuJson
  • FubuMVC.Diagnostics -- the diagnostics are merged into FubuMVC.Core now.
  • FubuMVC.Navigation -- don't use this if you don't need it
  • FubuMVC.Media -- try to eliminate this one too, Json.Net customization is probably better and much easier

In addition FubuMVC.Core.Assets was eliminated. There is also no more dependency on FubuLocalization, but that came back in 3.

Http Abstractions

The http abstractions were collapsed down to IHttpRequest and IHttpResponse. IOutputWriter still exists, but mostly just delegates to IHttpResponse. IClientConnectivity, ICurrentHttpRequest, IStreamingData, and all of the old services for reading or writing headers are gone. IRequestData still exists, but it's easier to use the new HTTP abstractions

StructureMap Usage

FubuMVC 2.* depends on StructureMap 3.*. SM 3.0's improved nested container support is a significant performance improvement

Breaking changes

  • The authorization model and interfaces was changed to be stateless. If you need services from a container, you take in a "context" argument that has access to the underlying container.

  • Content negotiation model is now stateless as well. Only impacts custom conneg readers/writers

  • Conneg is automatically turned on for all routes, but evaluated lazily. Default rules are to use json/xml/form+model binding in, and any matched views as html, json, and xml out. Actions that return strings are still "text/html" and anything returning HtmlString, HtmlDocument, or strings when the method is suffixed as "Html" returns "text/html"

Diagnostics

The diagnostics are embedded into FubuMVC.Core itself. Use DiagnosticsSettings to enable the diagnostic tracing in either production, verbose, or none levels.

Custom Policies

  • IConfigurationAction items can be added at either the Local (applies only to the endpoints in the current application or Bottle) or Global level. The new syntax is Policies.Global.**** or Policies.Local.****
  • ConfigurationType was eliminated altogether. Say amen.

fubu run

The fubu.exe run command has auto-refreshing abilities when static content files or the binaries change for a more productive development server. Uses Katana behind the scenes

New Features

  • Client Message for aggregated Json queries
  • NOWIN hosting support (but it's easier to use in 3)
  • There's a mechanism for disabling all security or just authorization or authentication via SecuritySettings
  • New ResourceNotFound mechanism for doing custom 404 handling on GET's when the route is good, but the resource in question cannot be found (data not in the db, etc)
  • Scenario's for testing. Got much better in FubuMVC 3, but some is in 2.0
  • The old "SettingsConvention" is built into FubuMVC.StructureMap

Assets

The old asset pipeline (FubuMVC.Core.Assets) was completely ripped out. The new "lightweight asset pipeline" is just helper methods to locate static files within a running application and construct <script> or <link> elements. We're assuming that asset management is done strictly by tools like web pack now. The OWIN hosting (Katana or NOWIN) has static file middleware added in automatically to handle requests for static content. There is some ability w/ AssetSettings to configure the file type white listing and caching headers. Do note that the new asset pipeline will completely turn off any kind of caching headers in "Development" mode and respects etag's.