Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Filter.cs « System.Web.Mvc « src - github.com/mono/aspnetwebstack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ec2f69ffd7d256c87c3047c00eb918994813cd5 (plain)
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
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.

namespace System.Web.Mvc
{
    public class Filter
    {
        public const int DefaultOrder = -1;

        public Filter(object instance, FilterScope scope, int? order)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (order == null)
            {
                IMvcFilter mvcFilter = instance as IMvcFilter;
                if (mvcFilter != null)
                {
                    order = mvcFilter.Order;
                }
            }

            Instance = instance;
            Order = order ?? DefaultOrder;
            Scope = scope;
        }

        public object Instance { get; protected set; }

        public int Order { get; protected set; }

        public FilterScope Scope { get; protected set; }
    }
}