TracNav
OpenRasta's Documentation...
- Release Notes
- FAQs
Downloading/Building OpenRasta...
- Download from source
- Download the binaries
- Run the test suite
- .NET versions support
Using OpenRasta...
- Configuration how-tos
What you need to know about dependency injection...
- Using Castle as the IoC container
- Using Ninject as the IoC container
Tutorials...
- Building your first OpenRasta website
- Creating views with no code-behind
- Writing handlers
- Using model binders?
- Implementing a Codec
- Extending OpenRasta with a Contributor
WebForms...
- Using multiple views for a resource
- Linking a URI to a static WebForm
Deployment...
- Installing OpenRasta on IIS
- Files required for production deployment?
Building web-sites with OpenRasta...
- Supporting clients that only know GET and POST
Reference...
Hosting...
- Root dependencies?
- Available dependencies
Configuration...
- ResourceSpace.Has
- ResourceSpace.Uses
Modules...
- SharpView
Pipeline...
- Pipeline contributors
- Well-known contributors
- PipelineContinuation members
Resources...
- Linking to resources
Handlers...
- Handler method selection
- Defined OperationResults
Binding...
- Object binders
- The default resource binder?
- ChangeSet<T> support?
Codecs...
- The Webforms Codec
- The XmlSerializer codec
- The JsonDataContract codec
- The XmlDataContract codec
Building Codecs...
- Building a media type reader
- Building a media type writer
- MediaType attribute
- Implementing configuration for ICodec
- Supporting binders and ChangeSet<> in a codec?
About OpenRasta
Is OpenRasta an MVC framework?
Strictly and semantically speaking, no. However, in reality developing with OpenRasta strongly resembles MVC development. Every part of the MVC triad has a direct counterpart in OpenRasta. The "Model" can be seen as "Resources", the "View" can be seen as a "Codec", and the "Controller" is a "Handler". If you were looking for the main difference in a nutshell, it's that OpenRasta's Codec mechanism is like the View part of MVC but vastly more flexible - you get to support many different representations of the same resource, whether you're writing that representation to a client's browser or responding to a client POST or PUT.
Can OpenRasta run in or alongside normal WebForms or ASP.NET MVC projects?
Yes.
What IoC containers does OpenRasta support?
OpenRasta supports Castle Windsor and NInject out of the box, although you don't actually require them. OpenRasta has its own built in dependency resolver if you don't need the heavyweight IoC support that these external frameworks provide.
In OpenRasta, how do I ... ?
... serve both XML Data Contract format and JSON from the same URI?
You just add .AsXmlDataContract() and .And.AsJsonDataContract() to the fluent configuration for a particular resource/handler combination. See the Configuration How-tos for a full example.
... register my own codec for my own format?
First you'll need to implement the codec. When you're done, you'll need to register it using the fluent configuration. See the Configuration how-tos for an example of registering your own codec.
... send a specific HTTP response code to the client?
If your handler method currently returns a resource class (for example, a Customer), change it to return an OperationResult. This operation result can optionally return the resource as part of itself, for example
public OperationResult GetCustomer(int customerId) { return new OperationResult.OK { ResponseResource = CustomerRepository.GetCustomer(customerId); } }
... serve a custom error representation when something went wrong?
See Serving resources using .WithoutUri() in the configuration How-tos.
... plug in my own IoC container?
- For Ninject, see using Ninject as the dependency resolver.
- For Castle, see using Castle as the dependency resolver.
Common technical questions
What's the point of .WithoutUri()? Why would I want to serve resources without a URI?
.WithoutUri() allows for circumstances where you need to serve a resource of a type other than the one that was requested. The common use case for this is serving a representation of an error which occurred when asking for the resource you really wanted. See Serving resources using .WithoutUri() in the configuration How-tos.
When do I need a PipelineContributor, a UriDecorator, or an IOperationInterceptor?
Pipeline Contributors are of use when you need to modify at a fundamental level what the pipeline is doing; what it's going to render, whether it should even continue at all - they should be seen as the lowest-level type of extension with potential to severely affect your site if you get it wrong. UriDecorators? are used when one needs only to add context to a call based on something the URI contains. IOperationInterceptor implementations should be used when you need to do something on a per-call basis but don't really care where in the pipeline they execute - just that they occur before or after the handler method takes place.
Why would I want to use Castle or Ninject if OpenRasta already has built-in IoC?
(with thanks to Barry Dahlberg)
You might want to use your favourite IoC container for a couple of reasons:
- You have existing infrastructure you want to leverage.
- You want to use advanced features of a container (for example, proxy generation).
Does OpenRasta support Unity?
Yes, it does, but is not part of the installation in the release candidate edition. It will be part of the default RTM build.
