Exemple #1
0
            public bool Equals(HandlerActionSource other)
            {
                if (ReferenceEquals(null, other))
                {
                    return(false);
                }
                if (ReferenceEquals(this, other))
                {
                    return(true);
                }

                if (other._markerTypes.Count() != _markerTypes.Count())
                {
                    return(false);
                }

                for (var i = 0; i < _markerTypes.Count(); i++)
                {
                    if (other._markerTypes.ElementAt(i) != _markerTypes.ElementAt(i))
                    {
                        return(false);
                    }
                }

                return(true);
            }
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            IEnumerable <Type> markers = _markerTypes.Any()
                                                                                        ? _markerTypes
                                                                                        : new Type[] { registry.GetType() };

            var source = new HandlerActionSource(markers);

            registry.Routes.UrlPolicy(PolicyBuilder(markers.ToArray()));
            registry.Actions.FindWith(source);
        }
        public void ApplyHandlerConventions(Func <Type[], HandlersUrlPolicy> policyBuilder, params Type[] markerTypes)
        {
            markerTypes.Each(t => Applies.ToAssembly(t.Assembly));

            var source = new HandlerActionSource(markerTypes);

            if (!_actionSources.Contains(source))
            {
                Routes.UrlPolicy(policyBuilder(markerTypes));

                Actions.FindWith(source);
            }
        }
Exemple #4
0
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            IEnumerable <Type> markers = _markerTypes.Any()
                                                                                        ? _markerTypes
                                                                                        : new Type[] { registry.GetType() };

            var source = new HandlerActionSource(markers);

            registry.AlterSettings <UrlPolicies>(urls =>
            {
                urls.Policies.Insert(0, PolicyBuilder(markers.ToArray()));
            });
            registry.Actions.FindWith(source);
        }