-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
37 lines (29 loc) · 959 Bytes
/
Copy pathREADME
File metadata and controls
37 lines (29 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
This dll takes some of the pain away from registering routes in OpenRasta.
It's on Nuget as "OpenRasta.Routing"
So instead of registering routes like this :
using (OpenRastaConfiguration.Manual)
{
ResourceSpace.Has.ResourcesOfType<object>()
.AtUri("/foo/{id}").Named("view-foo")
.HandledBy<FooHandler>()
.AsJsonDataContract()
.And.AsXmlDataContract();
}
You can just call :
using (OpenRastaConfiguration.Manual)
{
// Register all handler's routes in given assembly(s), and all model/wire types in given assembly(s)
Routing.Register(typeof(FooHandler).Assembly, typeof(Foo).Assembly);
}
And then tag your handlers :
public class FooHandler
{
[Get("/foo/{id}")]
public OperationResult Foo()
{
return new OperationResult.OK
{
ResponseResource = new Foo()
};
}
There are attributes for Get, Post, Put, Patch and Delete