Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / Filter.cs
1 namespace System.Web.Mvc {
2     using System.Diagnostics.CodeAnalysis;
3
4     public class Filter {
5         public const int DefaultOrder = -1;
6
7         public Filter(object instance, FilterScope scope, int? order) {
8             if (instance == null) {
9                 throw new ArgumentNullException("instance");
10             }
11
12             if (order == null) {
13                 IMvcFilter mvcFilter = instance as IMvcFilter;
14                 if (mvcFilter != null) {
15                     order = mvcFilter.Order;
16                 }
17             }
18
19             Instance = instance;
20             Order = order ?? DefaultOrder;
21             Scope = scope;
22         }
23
24         public object Instance {
25             get;
26             protected set;
27         }
28
29         public int Order {
30             get;
31             protected set;
32         }
33
34         public FilterScope Scope {
35             get;
36             protected set;
37         }
38     }
39 }