示例#1
0
        public IEnumerable <ActionCall> FindActions(TypePool types)
        {
            // TODO -- This should come from the container or use headless views
            var actionType = typeof(NotificationAction <>).MakeGenericType(typeof(NoOutputsNotification));

            yield return(new ActionCall(actionType, actionType.GetExecuteMethod()));
        }
示例#2
0
        public IEnumerable <ActionCall> FindActions(TypePool types)
        {
            // TODO -- this should be from the container or use headless views
            yield return(PartialActionFor <NavigationMenu>());

            yield return(PartialActionFor <AuthorizationReport>());

            yield return(PartialActionFor <BehaviorStart>());

            yield return(PartialActionFor <ExceptionReport>());

            yield return(PartialActionFor <FieldAccessReport>());

            yield return(PartialActionFor <FileOutputReport>());

            yield return(PartialActionFor <ModelBindingReport>());

            yield return(PartialActionFor <OutputReport>());

            yield return(PartialActionFor <RedirectReport>());

            yield return(PartialActionFor <SetValueReport>());

            yield return(PartialActionFor <BehaviorDetailsModel>());
        }
示例#3
0
        public IEnumerable <Type> Find()
        {
            var list = new List <string> {
                AppDomain.CurrentDomain.SetupInformation.ApplicationBase
            };

            string binPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;

            if (binPath.IsNotEmpty())
            {
                if (Path.IsPathRooted(binPath))
                {
                    list.Add(binPath);
                }
                else
                {
                    list.Add(AppDomain.CurrentDomain.SetupInformation.ApplicationBase.AppendPath(binPath));
                }
            }

            var assemblies = list.SelectMany(x => AssembliesFromPath(x));
            var pool       = new TypePool();

            pool.IgnoreExportTypeFailures = true;

            pool.AddAssemblies(assemblies);
            return(pool.TypesMatching(x => x.IsConcreteTypeOf <IApplicationSource>() && x.IsConcreteWithDefaultCtor()));
        }
示例#4
0
        public IEnumerable <ActionCall> FindActions(TypePool types)
        {
            var awesomeEntities = types.EntityTypes();

            var openHandlers = new[]
            {
                typeof(RestfulCreateHandler <>),
                typeof(RestfulPatchHandler <>),
                typeof(RestfulDeleteHandler <>),
                typeof(RestfulFindHandler <>),
                typeof(RestfulIndexHandler <>),
                typeof(AwesomeCreateHandler <>),
                typeof(AwesomeEditHandler <>)
            };

            foreach (var awesomeEntity in awesomeEntities)
            {
                foreach (var openHandler in openHandlers)
                {
                    var closedHandler = openHandler.MakeGenericType(awesomeEntity);
                    var closedMethod  = closedHandler.GetMethod("Execute", BindingFlags.Public | BindingFlags.Instance); //should drive from RestfulHandler

                    guard(closedHandler, closedMethod);

                    yield return(new ActionCall(closedHandler, closedMethod));
                }
            }
        }
示例#5
0
        public void SetUp()
        {
            graph   = new BehaviorGraph(null);
            matcher = new ActionSourceMatcher();

            pool = new TypePool(null);
        }
示例#6
0
    private GameObject GetObjectByTypePrivate(TypePool typePool, Vector3 pos, Quaternion quater, bool init)
    {
        PoolObject poolObject = _mapper[typePool];

        if (!init)
        {
            for (int j = 0; j < poolObject.lstObjectWasPool.Count; j++)
            {
                GameObject obj1 = poolObject.lstObjectWasPool [j];
                if (!obj1.activeSelf)
                {
                    obj1.transform.position = pos;
                    obj1.transform.rotation = quater;
                    obj1.SetActive(true);
                    return(obj1);
                }
            }
        }

        //init

        GameObject obj = Instantiate(poolObject.objectPool, Vector3.zero, Quaternion.identity) as GameObject;

        obj.transform.SetParent(transform);
        obj.transform.position = pos;
        obj.transform.rotation = quater;
        obj.SetActive(true);

        poolObject.lstObjectWasPool.Add(obj);
        Debug.LogWarning("INIT POOL INSTACE = " + typePool);
        return(obj);
    }
示例#7
0
        public static ConnegGraph Build(BehaviorGraph behaviorGraph)
        {
            var graph = new ConnegGraph();

            TypePool typePool = behaviorGraph.Types();
            var      writers  = typePool
                                .TypesMatching(
                x =>
                x.Closes(typeof(IMediaWriter <>)) && x.IsConcreteWithDefaultCtor() &&
                !x.IsOpenGeneric());

            graph.Writers.AddRange(writers);


            var readers = typePool
                          .TypesMatching(
                x =>
                x.Closes(typeof(IReader <>)) && x.IsConcreteWithDefaultCtor() &&
                !x.IsOpenGeneric());

            graph.Readers.AddRange(readers);


            return(graph);
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Actions.IncludeType <RestController1>();

            // TODO -- this really needs to be done with a Bottle
            var typePool = new TypePool();

            typePool.AddAssembly(Assembly.GetExecutingAssembly());

            registry.Policies.Add(new ConnegAttachmentPolicy(typePool));
            registry.Services <ResourcesServiceRegistry>();


            registry.Policies.Add(x => {
                x.Where.AnyActionMatches(
                    call => call.HandlerType == typeof(RestController1) && !call.Method.Name.StartsWith("Not"));

                x.Conneg.ApplyConneg();
            });

            theBehaviorGraph = BehaviorGraph.BuildFrom(registry);
            theConnegGraph   = new ConnegGraph(theBehaviorGraph);
        }
示例#9
0
 public ActionLessViewConvention(IEnumerable <IViewFacility> facilities, TypePool types, Func <Type, bool> viewTypeFilter, Action <BehaviorChain> configureChain)
 {
     _facilities     = facilities;
     _types          = types;
     _viewTypeFilter = viewTypeFilter;
     _configureChain = configureChain;
 }
示例#10
0
 public ActionLessViewConvention(IEnumerable<IViewFacility> facilities, TypePool types, Func<Type, bool> viewTypeFilter, Action<BehaviorChain> configureChain)
 {
     _facilities = facilities;
     _types = types;
     _viewTypeFilter = viewTypeFilter;
     _configureChain = configureChain;
 }
示例#11
0
        public void BuildBehaviors(TypePool pool, BehaviorGraph graph)
        {
            _graph = graph;

            pool.TypesMatching(TypeFilters.Matches).Each(scanMethods);
            _graph = null;
        }
 public void ConfigureContainer(TypePool pool, ContainerBuilder builder)
 {
     foreach (var ass in pool.Assemblies)
     {
         builder.RegisterApiControllers(ass);
     }
 }
        public void SetUp()
        {
            var pool = new TypePool(null);

            pool.AddAssembly(Assembly.GetExecutingAssembly());

            views = new WebFormViewFacility().FindViews(pool, new BehaviorGraph());
        }
 public RegisterDefaultGenerators(TypePool types)
     : base(types)
 {
     _typeExpression = new TypeCandidateExpression(this, types, new NulloTypeCandidateExpression());
     _typeExpression.IncludedTypesInNamespaceContaining<IGenerator>();
     _typeExpression.IncludeTypesImplementing<IGenerator>();
     _typeExpression.ExcludeTypes(t => t.IsInterface || typeof (IEntityGenerator).IsAssignableFrom(t));
 }
        public void Setup()
        {
            var types = new TypePool();

            types.AddAssembly(GetType().Assembly);

            _runner = new ViewEngines();
        }
示例#16
0
        public void removing_the_called_assembly()
        {
            var pool = new TypePool(GetType().Assembly);

            pool.IgnoreCallingAssembly();

            pool.Assemblies.ShouldNotContain(GetType().Assembly);
        }
示例#17
0
 private TypePool _GetTypePool(Type Type)
 {
     if (!Items.ContainsKey(Type))
     {
         Items[Type] = new TypePool(Type);
     }
     return(Items[Type]);
 }
示例#18
0
    public void HidePool(TypePool typePool)
    {
        PoolObject poolObject = _mapper[typePool];

        for (int j = 0; j < poolObject.lstObjectWasPool.Count; j++)
        {
            poolObject.lstObjectWasPool[j].SetActive(false);
        }
    }
示例#19
0
        public void should_return_all_types_with_full_name()
        {
            var pool = new TypePool();

            pool.AddType(generateType("namespace FubuMVC.Core{public class Endpoint{}}", "FubuMVC.Core.Endpoint"));
            pool.AddType(typeof(Core.Endpoint));

            pool.TypesWithFullName(typeof(Core.Endpoint).FullName).ShouldHaveCount(2);
        }
示例#20
0
 public void BuildChains(TypePool pool, CommandGraph graph)
 {
     pool
         .TypesMatching(TypeFilters.Matches)
         .Each(t =>
                   {
                       graph.AddChainForNew(new CommandChain(t));
                       graph.AddChainForExisting(new CommandChain(t));
                   });
 }
        public void ConfigureContainer(TypePool pool, ContainerBuilder builder)
        {
            builder.RegisterType<WindowsIdentityContext>()
                .As<IIdentityContext>();

            //TODO: Log this

            builder.RegisterType<DropShipDispatcher>()
                .As<IDispatcher>();
        }
示例#22
0
        public AssemblyScanner()
        {
            _types = new TypePool(GetType().Assembly)
            {
                ShouldScanAssemblies = true
            };
            _typeFilters = new CompositeFilter <Type>();

            IncludeTypes(t => t.Namespace.StartsWith(GetType().Namespace));
        }
示例#23
0
        public void BuildBehaviors(TypePool pool, BehaviorGraph graph)
        {
            _graph = graph;

            // Do not do any assembly scanning if no type or method filters are set
            pool.ShouldScanAssemblies = HasFilters();

            pool.TypesMatching(TypeFilters.Matches).Each(scanMethods);
            _graph = null;
        }
示例#24
0
 public IEnumerable <IViewToken> FindViews(TypePool types, BehaviorGraph graph)
 {
     return(_composer.Compose(types)
            .AllTemplates()
            // TODO : Clean this up
            .Where(x => x.Descriptor is ViewDescriptor)
            .Select(x => x.Descriptor.As <ViewDescriptor>())
            .Where(x => x.HasViewModel())
            .Select(x => new SparkViewToken(x)));
 }
示例#25
0
 public IEnumerable<ActionCall> FindActions(TypePool types)
 {
     // Do not do any assembly scanning if no type or method filters are set
     types.ShouldScanAssemblies = HasFilters();
     return types
         .TypesMatching(TypeFilters.Matches)
         .SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Public)
                                 .Select(x => _actionCallProvider(type, x))
                                 .Where(MethodFilters.Matches));
 }
示例#26
0
        private TypePool typePool()
        {
            var pool = new TypePool(GetType().Assembly);

            pool.AddType(generateType("namespace FubuMVC.Spark.Tests.SparkModel.Binding{public class Bar{}}", "FubuMVC.Spark.Tests.SparkModel.Binding.Bar"));
            pool.AddType <Bar>();
            pool.AddType <Baz>();

            return(pool);
        }
 public IEnumerable <IViewToken> FindViews(TypePool types, BehaviorGraph graph)
 {
     // clean up pending
     return(_templateRegistry
            .AllTemplates()
            .Where(x => x.Descriptor is ViewDescriptor)
            .Select(x => x.Descriptor.As <ViewDescriptor>())
            .Where(x => x.HasViewModel())
            .Select(x => new SparkViewToken(x)));
 }
示例#28
0
        public IEnumerable <IViewToken> FindViews(BehaviorGraph graph)
        {
            var types = new TypePool();

            types.AddAssemblies(AppDomain.CurrentDomain.GetAssemblies());
            types.IgnoreExportTypeFailures = true;

            return(types.TypesMatching(t => t.IsConcrete() && t.Closes(typeof(FubuHtmlDocument <>)) && !t.Equals(typeof(FubuHtmlDocument <>)))
                   .Select(t => new HtmlDocumentViewToken(t)));
        }
示例#29
0
        public void BuildBehaviors(TypePool pool, BehaviorGraph graph)
        {
            _graph = graph;

            // Do not do any assembly scanning if no type or method filters are set
            pool.ShouldScanAssemblies = HasFilters();

            pool.TypesMatching(TypeFilters.Matches).Each(scanMethods);
            _graph = null;
        }
示例#30
0
        public override void ModifyMesh(VertexHelper vh)
        {
            if (!IsActive())
            {
                return;
            }
            List <UIVertex> verts = TypePool <List <UIVertex> > .Get();

            vh.GetUIVertexStream(verts);

            var neededCpacity = verts.Count * 9;

            if (verts.Capacity < neededCpacity)
            {
                verts.Capacity = neededCpacity;
            }

            var start = 0;
            var end   = verts.Count;

            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, effectDistance.y);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, -effectDistance.y);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, effectDistance.y);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, -effectDistance.y);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, 0);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, 0);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, 0, -effectDistance.y);

            start = end;
            end   = verts.Count;
            ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, 0, effectDistance.y);

            vh.Clear();
            vh.AddUIVertexTriangleStream(verts);
            verts.Clear();
            TypePool <List <UIVertex> > .Put(verts);
        }
示例#31
0
        public void RunConfigurations()
        {
            _configurations.Each(x => {
                x.Register(this);
                x.Configure(_graph);
            });

            var types = new TypePool();

            _scanners.Each(x => x.ScanForTypes(types, _graph));
        }
示例#32
0
        public void SetUp()
        {
            TypePool.FindTheCallingAssembly().FullName.ShouldEqual(Assembly.GetExecutingAssembly().FullName);

            source = new ActionSource();
            _graph = new Lazy <BehaviorGraph>(() => {
                return(BehaviorGraph.BuildFrom(r => {
                    r.Actions.FindWith(source);
                }));
            });
        }
        public static void ApplySmartGridConventions(this FubuRegistry registry, Action <AppliesToExpression> configure)
        {
            var pool = new TypePool(null);

            pool.IgnoreCallingAssembly();

            var expression = new AppliesToExpression(pool);

            configure(expression);

            registry.ApplyConvention(new SmartGridConvention(pool));
        }
示例#34
0
        protected override void beforeEach()
        {
            theGraph = ValidationGraph.BasicGraph();
            Services.Inject(theGraph);

            theTypes = new TypePool();
            theTypes.AddType <RegistrationTargetRules>();

            Services.PartialMockTheClassUnderTest();
            ClassUnderTest.Stub(x => x.Types()).Return(theTypes);

            ClassUnderTest.Activate(new IPackageInfo[0], new PackageLog());
        }
示例#35
0
        public void RunConfigurations()
        {
            _configurations.Each(x => {
                // Change this to using the FubuCore.Description later
                _graph.Log.StartSource(x.ToString());
                x.Register(this);
                x.Configure(_graph);
            });

            var types = new TypePool(_graph);

            _scanners.Each(x => x.ScanForTypes(types, _graph));
        }
示例#36
0
        public IEnumerable <IViewToken> FindViews(TypePool types, BehaviorGraph graph)
        {
            // TODO: Make it not filter against view model as the
            // default view attacher conventions will do this.
            // Opens up for returning view with no model in edge cases
            // and add custom view attacher convention.

            return(_templateRegistry
                   .AllTemplates()
                   .Where(x => x.Descriptor is ViewDescriptor)
                   .Select(x => x.Descriptor.As <ViewDescriptor>())
                   .Where(x => x.HasViewModel())
                   .Select(x => new SparkViewToken(x)));
        }
示例#37
0
        private TypePool typePool()
        {
            var pool = new TypePool();

            pool.AddAssembly(GetType().Assembly);

            pool.AddType(generateType("namespace FubuMVC.Razor.Tests.RazorModel.Binding{public class Bar{}}", "FubuMVC.Razor.Tests.RazorModel.Binding.Bar"));
            pool.AddType <Bar>();
            pool.AddType <Baz>();
            pool.AddType <Generic <Baz> >();
            pool.AddType <Generic <Baz, Bar> >();

            return(pool);
        }
示例#38
0
        public void SetUp()
        {
            matcher = new ActionSource(new ActionMethodFilter());

            pool = new TypePool(null);
            pool.IgnoreCallingAssembly();

            pool.AddType <DifferentPatternClass>();
            pool.AddType <OneController>();
            pool.AddType <TwoController>();
            pool.AddType <ThreeController>();

            calls = null;
        }
示例#39
0
 public EntityMatcher(TypePool types)
     : base(types)
 {
 }
示例#40
0
 public void RegisterBuilders(TypePool pool, IEnumerable<IEntityBuilderRegistrationConvention> conventions, EntityBuilderRegistry registry)
 {
     pool
         .TypesMatching(TypeFilters.Matches)
         .Each(t => conventions.Each(convention => convention.Process(t, registry)));
 }
示例#41
0
 public TypeMatcher(TypePool types)
 {
     _types = types;
     _typeFilters = new CompositeFilter<Type>();
 }
示例#42
0
 public void EachType(TypePool types, Action<Type> action)
 {
     types
         .TypesMatching(TypeFilters.Matches)
         .Each(action);
 }
 public void ConfigureContainer(TypePool pool, ContainerBuilder builder)
 {
 }
示例#44
0
 public void BuildChains(TypePool types, ValidationGraph graph)
 {
     types
         .TypesMatching(TypeFilters.Matches)
         .Each(type => graph.AddChain(ValidationChain.GenericForModel(type)));
 }
示例#45
0
 public ConnegAttachmentPolicy(TypePool types)
 {
     _types = types;
 }