예제 #1
0
        public ApplicationInstance CreateApp()
        {
            var codeSrc = _scripts.Get("/main.os");

            _webEng.Environment.InjectObject(new WebGlobalContext(this, codeSrc));
            _webEng.Engine.UpdateContexts();

            return(ApplicationInstance.Create(codeSrc, _webEng));
        }
        private void FillContext(IEnumerable <string> sources, ApplicationModelProviderContext context)
        {
            var attrList  = new List <string>();
            var reflector = new TypeReflectionEngine();

            foreach (var virtualPath in sources)
            {
                var codeSrc      = _scriptsProvider.Get(virtualPath);
                var module       = LoadControllerCode(codeSrc);
                var baseFileName = System.IO.Path.GetFileNameWithoutExtension(codeSrc.SourceDescription);
                var type         = reflector.Reflect(module, baseFileName);
                var cm           = new ControllerModel(typeof(ScriptedController).GetTypeInfo(), attrList.AsReadOnly());
                cm.ControllerName = type.Name;
                cm.Properties.Add("module", module);
                cm.Properties.Add("type", type);
                FillActions(cm, type, GetExportedMethods(module));

                context.Result.Controllers.Add(cm);
            }
        }
예제 #3
0
        public ApplicationInstance CreateApp()
        {
            var codeSrc = _scripts.Get("/main.os");

            return(ApplicationInstance.Create(codeSrc, _webEng));
        }