/// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                _compilerServices = new CompilerServices();
                _controlSystem    = new ControlSystem(Settings.Host, Settings.Port, Settings.Username, Settings.Password);

                //Check to see if a solution is open, if not, exit
                if (!_compilerServices.IsSolutionOpen())
                {
                    return;
                }

                Package.OutputWindowWriteLine($"Publishing to {Package.Settings.Host}.");

                //Stop the application on the server
                _controlSystem.StopProgram(Package);

                //Compile solution
                _compilerServices.BuildComplete += CompilerServices_BuildComplete;
                _compilerServices.Build(Package);
            }
            catch (Exception ex)
            {
                Package.OutputWindowWriteLine("Unable to publish.  An unknown error occured.");
                Package.DebugWriteLine(ex);
            }
        }
        private void utBtnCompile_Click(object sender, EventArgs e)
        {
            lstCompilerResults.Items.Clear();

            lstCompilerResults.Items.Add("Initializing Compiler Services..");

            var compilerSvc = new CompilerServices();

            lstCompilerResults.Items.Add("Compiling..");
            var result = compilerSvc.CompileInput(rtbCode.Text);

            if (result.Errors.HasErrors)
            {
                foreach (var error in result.Errors)
                {
                    lstCompilerResults.Items.Add(error);
                }
            }
            else
            {
                lstCompilerResults.Items.Add("Compiled Successfully!");

                if (chkRunAfterCompile.Checked)
                {
                    Process.Start(result.PathToAssembly);
                }
            }
        }
Esempio n. 3
0
        private static dynamic InstanceEval(object self, string eval, NovaScope scope)
        {
            if (!(self is NovaInstance instance))
            {
                return(null);
            }

            var        xexpression = string.Format("{0};", eval);
            var        res         = NovaParser.Parse(xexpression);
            Expression block;

            if (res != null)
            {
                scope["self"] = scope["super"] = instance;
                scope["<nova_context_invokemember>"] = true;
                string selfName;
                var    selfScope = scope.SearchForObject(instance, out selfName);
                if (selfScope != null && selfName != null)
                {
                    scope["<nova_context_selfscope>"] = selfScope;
                    scope["<nova_context_selfname>"]  = selfName;
                }
                block = NovaExpression.NovaBlock(res);
                // We want eval'd expressions to execute in the current scope, not its own child scopes.  This ensures assignment evals work properly.
                ((BlockExpression)block).Scope = scope;
                ((BlockExpression)block).SetChildrenScopes(scope);
            }
            else
            {
                return(null);
            }
            var val = CompilerServices.CreateLambdaForExpression(block)();

            return(val);
        }
Esempio n. 4
0
 public void CompareString([DataSources] string context)
 {
     using (var db = GetDataContext(context))
         AreEqual(
             from p in db.Person where p.FirstName == "John" select p,
             CompilerServices.CompareString(db));
 }
Esempio n. 5
0
        bool tryFindMember()
        {
            if (member != null)
            {
                throw new Exception("member already found");
            }
            if (Address == null)
            {
                return(false);
            }
            if (Address.Count == 0)
            {
                return(false);
            }
            Type t = Address.LastOrDefault().CrowType;

            member = t.GetMember(memberName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).FirstOrDefault();

            #region search for extensions methods if member not found in type
            if (member == null && !string.IsNullOrEmpty(memberName))
            {
                Assembly a  = Assembly.GetExecutingAssembly();
                string   mn = memberName;
                member = CompilerServices.GetExtensionMethods(a, t).Where(em => em.Name == mn).FirstOrDefault();
            }
            #endregion

            return(member != null);
        }
Esempio n. 6
0
        /// <summary>
        /// Emits the handler method addition, done at end of parsing, Loc_0 is root node instance
        /// </summary>
        /// <param name="bd">Bd.</param>
        /// <param name="evt">passed as arg to prevent refetching it for the 3rd time</param>
        public void emitHandlerMethodAddition(EventBinding bd)
        {
            //fetch source instance with address for handler addition (as 1st arg of handler.add)
            il.Emit(OpCodes.Ldloc_0);             //push root
            CompilerServices.emitGetInstance(il, bd.SourceNA);

            il.Emit(OpCodes.Ldloc_0);
            CompilerServices.emitGetInstance(il, bd.TargetNA);

            string[] membs = bd.TargetMember.Split('.');
            for (int i = 0; i < membs.Length - 1; i++)
            {
                il.Emit(OpCodes.Dup);
                il.Emit(OpCodes.Ldstr, membs[i]);
                il.Emit(OpCodes.Call, CompilerServices.miGetMembIinfoWithRefx);
                il.Emit(OpCodes.Call, CompilerServices.miGetValWithRefx);
            }

            //load handlerType of sourceEvent to create handler delegate (1st arg)
            il.Emit(OpCodes.Ldtoken, bd.SourceEvent.EventHandlerType);
            il.Emit(OpCodes.Call, CompilerServices.miGetTypeFromHandle);
            //load methodInfo (3rd arg)
            il.Emit(OpCodes.Ldstr, membs[membs.Length - 1]);
            il.Emit(OpCodes.Callvirt, CompilerServices.miCreateDel);
            il.Emit(OpCodes.Callvirt, bd.SourceEvent.AddMethod);             //call add event
        }
 public void CompareString1()
 {
     ForEachProvider(db =>
     {
         var str = CompilerServices.CompareString(db).ToString();
         Assert.That(str.IndexOf("CASE"), Is.EqualTo(-1));
     });
 }
 public void CompareString1(string context)
 {
     using (var db = GetDataContext(context))
     {
         var str = CompilerServices.CompareString(db).ToString();
         Assert.That(str.IndexOf("CASE"), Is.EqualTo(-1));
     }
 }
Esempio n. 9
0
 public void CompareString1([IncludeDataSources(TestProvName.AllSQLite)] string context)
 {
     using (var db = GetDataContext(context))
     {
         var query = (IQueryable <Person>)CompilerServices.CompareString(db);
         var str   = query.ToString();
         TestContext.WriteLine(str);
         Assert.That(str, Does.Not.Contain("CASE"));
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Emits cached delegate handler addition in the context of instantiator (ctx)
 /// </summary>
 public void emitCachedDelegateHandlerAddition(int index, EventInfo evt, NodeAddress address = null)
 {
     il.Emit(OpCodes.Ldloc_0);                 //load ref to current graphic object
     CompilerServices.emitGetInstance(il, address);
     il.Emit(OpCodes.Ldarg_0);                 //load ref to this instanciator onto the stack
     il.Emit(OpCodes.Ldfld, CompilerServices.fiCachedDel);
     il.Emit(OpCodes.Ldc_I4, index);           //load delegate index
     il.Emit(OpCodes.Callvirt, CompilerServices.miGetDelegateListItem);
     il.Emit(OpCodes.Callvirt, evt.AddMethod); //call add event
 }
Esempio n. 11
0
        public void Register(IAppHost appHost)
        {
            this.ScanRootPath       = this.ScanRootPath ?? appHost.Config.WebHostPhysicalPath;
            this.VirtualFileSources = VirtualFileSources ?? appHost.VirtualFileSources;
            this.WebHostUrl         = WebHostUrl ?? appHost.Config.WebHostUrl;
            this.EnableLiveReload   = this.EnableLiveReload ?? appHost.Config.DebugMode;
            if (CheckLastModifiedForChanges == true)
            {
                EnableLiveReload = false; //Don't enable both File Watcher + LastModified checks
            }
            this.PrecompilePages = this.PrecompilePages ?? !this.EnableLiveReload;
            this.WaitForPrecompilationOnStartup = this.WaitForPrecompilationOnStartup ?? !this.EnableLiveReload;

            if (LoadUnloadedAssemblies)
            {
                var loadedAssemblyNames = CompilerServices
                                          .GetLoadedAssemblies()
                                          .Where(x => !x.IsDynamic)
                                          .Map(x => x.FullName.SplitOnFirst(',')[0]);

                foreach (var razorNamespace in appHost.Config.RazorNamespaces)
                {
                    try
                    {
                        if (razorNamespace.StartsWith("System") ||
                            razorNamespace.StartsWith("ServiceStack"))
                        {
                            continue;
                        }

                        if (!loadedAssemblyNames.Contains(razorNamespace))
                        {
                            Assembly.Load(razorNamespace);
                        }
                    }
                    catch { /*Ignore namespaces that don't map to assemblies*/ }
                }
            }

            try
            {
                Init();

                BindToAppHost(appHost);
            }
            catch (Exception ex)
            {
                appHost.NotifyStartupException(ex);
                throw;
            }
        }
Esempio n. 12
0
        public Context(Type rootType)
        {
            RootType = rootType;
            dm       = new DynamicMethod("dyn_instantiator",
                                         CompilerServices.TObject, new Type [] { typeof(Instantiator), typeof(Interface) }, true);
            il = dm.GetILGenerator(256);

            il.DeclareLocal(typeof(GraphicObject));
            il.Emit(OpCodes.Nop);
            //set local GraphicObject to root object
            il.Emit(OpCodes.Newobj, rootType.GetConstructors() [0]);
            il.Emit(OpCodes.Stloc_0);
            CompilerServices.emitSetCurInterface(il);
        }
Esempio n. 13
0
        public void Register(IAppHost appHost)
        {
            this.ScanRootPath       = this.ScanRootPath ?? appHost.WebHostPhysicalPath;
            this.VirtualFileSources = VirtualFileSources ?? appHost.VirtualFileSources;
            this.WebHostUrl         = WebHostUrl ?? appHost.Config.WebHostUrl;
            this.EnableLiveReload   = this.EnableLiveReload ?? appHost.Config.DebugMode;
            if (CheckLastModifiedForChanges == true)
            {
                EnableLiveReload = false; //Don't enable both File Watcher + LastModified checks
            }
            this.PrecompilePages = this.PrecompilePages ?? !this.EnableLiveReload;
            this.WaitForPrecompilationOnStartup = this.WaitForPrecompilationOnStartup ?? !this.EnableLiveReload;

            if (LoadUnloadedAssemblies)
            {
                var loadedAssemblyNames = CompilerServices
                                          .GetLoadedAssemblies()
                                          .Where(x => !x.IsDynamic)
                                          .Map(x => x.FullName.LeftPart(','));

                foreach (var razorNamespace in appHost.Config.RazorNamespaces)
                {
                    try
                    {
                        if (razorNamespace.StartsWith("System") ||
                            razorNamespace.StartsWith("ServiceStack"))
                        {
                            continue;
                        }

                        if (!loadedAssemblyNames.Contains(razorNamespace))
                        {
                            Assembly.Load(razorNamespace);
                        }
                    }
                    catch { /*Ignore namespaces that don't map to assemblies*/ }
                }
            }

            Init();

            BindToAppHost(appHost);

            appHost.GetPlugin <MetadataFeature>()
            ?.AddLink(MetadataFeature.AvailableFeatures, "http://docs.servicestack.net/razor-notes", nameof(RazorFormat));
        }
Esempio n. 14
0
        /// <summary>
        /// Emits the handler method addition, done at end of parsing, Loc_0 is root node instance
        /// </summary>
        /// <param name="bd">Bd.</param>
        /// <param name="evt">passed as arg to prevent refetching it for the 3rd time</param>
        public void emitHandlerMethodAddition(EventBinding bd)
        {
            //fetch source instance with address for handler addition (as 1st arg of handler.add)
            il.Emit(OpCodes.Ldloc_0);             //push root
            CompilerServices.emitGetInstance(il, bd.SourceNA);

            //load handlerType of sourceEvent to create handler delegate (1st arg)
            il.Emit(OpCodes.Ldtoken, bd.SourceEvent.EventHandlerType);
            il.Emit(OpCodes.Call, CompilerServices.miGetTypeFromHandle);
            //load target the where the method is defined (2nd arg)
            il.Emit(OpCodes.Ldloc_0);
            CompilerServices.emitGetInstance(il, bd.TargetNA);
            //load methodInfo (3rd arg)
            il.Emit(OpCodes.Ldstr, bd.TargetMember);

            il.Emit(OpCodes.Callvirt, CompilerServices.miCreateDel);

            il.Emit(OpCodes.Callvirt, bd.SourceEvent.AddMethod);             //call add event
        }
Esempio n. 15
0
 public StatementSpecMapEnv(
     ImportServiceCompileTime importService,
     VariableCompileTimeResolver variableCompileTimeResolver,
     Configuration configuration,
     ExprDeclaredCompileTimeResolver exprDeclaredCompileTimeResolver,
     ContextCompileTimeResolver contextCompileTimeResolver,
     TableCompileTimeResolver tableCompileTimeResolver,
     ScriptCompileTimeResolver scriptCompileTimeResolver,
     CompilerServices compilerServices)
 {
     ImportService = importService;
     VariableCompileTimeResolver = variableCompileTimeResolver;
     Configuration = configuration;
     ExprDeclaredCompileTimeResolver = exprDeclaredCompileTimeResolver;
     ContextCompileTimeResolver = contextCompileTimeResolver;
     TableCompileTimeResolver = tableCompileTimeResolver;
     ScriptCompileTimeResolver = scriptCompileTimeResolver;
     CompilerServices = compilerServices;
 }
Esempio n. 16
0
        private void CompileAndExecute(string customCode, object sender)
        {
            var engine = (IAutomationEngineInstance)sender;
            //compile custom code
            var compilerSvc = new CompilerServices();
            var result      = compilerSvc.CompileInput(customCode);

            //check for errors
            if (result.Errors.HasErrors)
            {
                //throw exception
                var errors = string.Join(", ", result.Errors);
                throw new Exception("Errors Occured: " + errors);
            }
            else
            {
                var arguments = v_Args.ConvertUserVariableToString(engine);

                //run code, OpenBots will wait for the app to exit before resuming
                using (Diagnostics.Process scriptProc = new Diagnostics.Process())
                {
                    scriptProc.StartInfo.FileName  = result.PathToAssembly;
                    scriptProc.StartInfo.Arguments = arguments;

                    if (v_OutputUserVariableName != "")
                    {
                        //redirect output
                        scriptProc.StartInfo.RedirectStandardOutput = true;
                        scriptProc.StartInfo.UseShellExecute        = false;
                    }

                    scriptProc.Start();
                    scriptProc.WaitForExit();

                    if (v_OutputUserVariableName != "")
                    {
                        var output = scriptProc.StandardOutput.ReadToEnd();
                        output.StoreInUserVariable(engine, v_OutputUserVariableName, nameof(v_OutputUserVariableName), this);
                    }
                }
            }
        }
Esempio n. 17
0
 private static int Main(string[] args)
 {
     try {
         if (args.Length == 0)
         {
             Console.WriteLine("Usage: yajs filename.js");
             return(-1);
         }
         var stopwatch = Stopwatch.StartNew();
         var vm        = new VirtualMachine(new CompilerServices());
         vm.GlobalObject.OwnMembers.Add("console", new JSConsole(vm));
         var program  = CompilerServices.Compile(args[0]);
         var exitCode = vm.Execute(program);
         Console.WriteLine("Total execution time: {0} ms", stopwatch.ElapsedMilliseconds);
         return(exitCode.CastToInteger());
     }
     catch (Exception ex) {
         Console.WriteLine(ex.Message);
         return(-1);
     }
 }
Esempio n. 18
0
        public IMLContext(Type rootType)
        {
            RootType = rootType;
            dm       = new DynamicMethod("dyn_instantiator",
                                         CompilerServices.TObject, new Type [] { typeof(Instantiator), typeof(Interface) }, true);
            il = dm.GetILGenerator(256);

            il.DeclareLocal(typeof(GraphicObject));
            il.Emit(OpCodes.Nop);
            //set local GraphicObject to root object
            ConstructorInfo ci = rootType.GetConstructor(
                BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
                null, Type.EmptyTypes, null);

            if (ci == null)
            {
                throw new Exception("No default parameterless constructor found in " + rootType.Name);
            }
            il.Emit(OpCodes.Newobj, ci);
            il.Emit(OpCodes.Stloc_0);
            CompilerServices.emitSetCurInterface(il);
        }
Esempio n. 19
0
        private static dynamic Eval(string eval, NovaScope scope)
        {
            var xexpression = string.Format("{0};", eval);

            var        res = NovaParser.Parse(xexpression);
            Expression block;

            if (res != null)
            {
                block = NovaExpression.NovaBlock(res);
                // We want eval'd expressions to execute in the current scope, not its own child scopes.  This ensures assignment evals work properly.
                ((BlockExpression)block).Scope = scope;
                ((BlockExpression)block).SetChildrenScopes(scope);
            }
            else
            {
                return(null);
            }
            var val = CompilerServices.CreateLambdaForExpression(block)();

            return(val);
        }
Esempio n. 20
0
        public override void Execute()
        {
            LoadInput();

            try
            {
                if (!(inputPins[0].Data as PathDescriptor).Exists())
                {
                    string name = (inputPins[0].Data as PathDescriptor).Name;
                    ((Action)(() =>
                    {
                        Application.Error(SeverityFlags.None, "Directory '{0}' not found", name);
                    })).Once(name.Fnv32());

                    Cancel();
                    return;
                }

                bool isDefault; if (CompilerServices.Targets.Length == 0 && CompilerServices.SetDefaultTarget())
                {
                    isDefault = true;
                }
                else
                {
                    isDefault = false;
                }

                for (int i = 0; i < CompilerServices.Targets.Length; i++)
                {
                    Project project; if (!FromCache(CompilerServices.Targets[i], SystemTags.Cpp, inputPins[0].Data as PathDescriptor, out project))
                    {
                        List <FileSystemDescriptor> files = Application.GetProjectFiles(inputPins[0].Data as PathDescriptor, Extensions);
                        if (files.Count > 0)
                        {
                            if (isDefault)
                            {
                                ((Action)(() =>
                                {
                                    Application.Warning(SeverityFlags.None, "C++ build target missing. Selecting {0} as target", CompilerServices.Targets[0].TechnicalName);
                                })).Once(CompilerServices.Targets[0].TechnicalName.Fnv32());
                            }

                            project = CreateProject(project, files);
                            Application.Log(SeverityFlags.Full, "Loaded {0} project {1}::{2}", ToolDisplayName, project.Name, project.Target.TechnicalName);
                            outputPins[i].Data = project;
                        }
                        else
                        {
                            Cancel();
                        }
                    }
                    else
                    {
                        if (isDefault)
                        {
                            ((Action)(() =>
                            {
                                Application.Warning(SeverityFlags.None, "C++ build target missing. Selecting {0} as target", CompilerServices.Targets[0].TechnicalName);
                            })).Once(CompilerServices.Targets[0].TechnicalName.Fnv32());
                        }

                        Application.Log(SeverityFlags.Full, "Cached {0} project {1}::{2}", ToolDisplayName, project.Name, project.Target.TechnicalName);
                        outputPins[i].Data = project;
                    }
                }
            }
            catch (Exception e)
            {
                Cancel();
                throw e;
            }
        }
Esempio n. 21
0
 public IProjectCompiler GetCompiler(TypeInformation provider)
 {
     // Load the factory
     return(_compilers.GetOrAdd(provider, typeInfo =>
                                CompilerServices.CreateService <IProjectCompiler>(_context.Services, _compilerLoadContext.Value, typeInfo)));
 }
Esempio n. 22
0
        public ModuleCompileTimeServices(
            IContainer container,
            CompilerServices compilerServices,
            Configuration configuration,
            ContextCompileTimeRegistry contextCompileTimeRegistry,
            ContextCompileTimeResolver contextCompileTimeResolver,
            BeanEventTypeStemService beanEventTypeStemService,
            BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate,
            ClassProvidedCompileTimeRegistry classProvidedCompileTimeRegistry,
            ClassProvidedCompileTimeResolver classProvidedCompileTimeResolver,
            DatabaseConfigServiceCompileTime databaseConfigServiceCompileTime,
            ImportServiceCompileTime importService,
            ExprDeclaredCompileTimeRegistry exprDeclaredCompileTimeRegistry,
            ExprDeclaredCompileTimeResolver exprDeclaredCompileTimeResolver,
            EventTypeAvroHandler eventTypeAvroHandler,
            EventTypeCompileTimeRegistry eventTypeCompileTimeRegistry,
            EventTypeCompileTimeResolver eventTypeCompileTimeResolver,
            EventTypeRepositoryImpl eventTypeRepositoryPreconfigured,
            bool fireAndForget,
            IndexCompileTimeRegistry indexCompileTimeRegistry,
            ModuleDependenciesCompileTime moduleDependencies,
            ModuleAccessModifierService moduleVisibilityRules,
            NamedWindowCompileTimeResolver namedWindowCompileTimeResolver,
            NamedWindowCompileTimeRegistry namedWindowCompileTimeRegistry,
            ParentClassLoader parentClassLoader,
            PatternObjectResolutionService patternObjectResolutionService,
            ScriptCompileTimeRegistry scriptCompileTimeRegistry,
            ScriptCompileTimeResolver scriptCompileTimeResolver,
            ScriptCompiler scriptCompiler,
            SerdeEventTypeCompileTimeRegistry serdeEventTypeRegistry,
            SerdeCompileTimeResolver serdeResolver, 
            TableCompileTimeRegistry tableCompileTimeRegistry,
            TableCompileTimeResolver tableCompileTimeResolver,
            VariableCompileTimeRegistry variableCompileTimeRegistry,
            VariableCompileTimeResolver variableCompileTimeResolver,
            ViewResolutionService viewResolutionService,
            XMLFragmentEventTypeFactory xmlFragmentEventTypeFactory)
        {
            var generation = Interlocked.Increment(ref _generation);
            
            Namespace = $"generation_{generation}";

            Container = container;
            CompilerServices = compilerServices;
            Configuration = configuration;
            ContextCompileTimeRegistry = contextCompileTimeRegistry;
            ContextCompileTimeResolver = contextCompileTimeResolver;
            BeanEventTypeStemService = beanEventTypeStemService;
            BeanEventTypeFactoryPrivate = beanEventTypeFactoryPrivate;
            DatabaseConfigServiceCompileTime = databaseConfigServiceCompileTime;
            ImportServiceCompileTime = importService;
            ExprDeclaredCompileTimeRegistry = exprDeclaredCompileTimeRegistry;
            ExprDeclaredCompileTimeResolver = exprDeclaredCompileTimeResolver;
            EventTypeAvroHandler = eventTypeAvroHandler;
            EventTypeCompileTimeRegistry = eventTypeCompileTimeRegistry;
            EventTypeCompileTimeResolver = eventTypeCompileTimeResolver;
            EventTypeRepositoryPreconfigured = eventTypeRepositoryPreconfigured;
            IndexCompileTimeRegistry = indexCompileTimeRegistry;
            ModuleDependencies = moduleDependencies;
            ModuleVisibilityRules = moduleVisibilityRules;
            NamedWindowCompileTimeResolver = namedWindowCompileTimeResolver;
            NamedWindowCompileTimeRegistry = namedWindowCompileTimeRegistry;
            ParentClassLoader = parentClassLoader;
            PatternObjectResolutionService = patternObjectResolutionService;
            ScriptCompileTimeRegistry = scriptCompileTimeRegistry;
            ScriptCompileTimeResolver = scriptCompileTimeResolver;
            ScriptCompiler = scriptCompiler;
            TableCompileTimeRegistry = tableCompileTimeRegistry;
            TableCompileTimeResolver = tableCompileTimeResolver;
            VariableCompileTimeRegistry = variableCompileTimeRegistry;
            VariableCompileTimeResolver = variableCompileTimeResolver;
            ViewResolutionService = viewResolutionService;
            XmlFragmentEventTypeFactory = xmlFragmentEventTypeFactory;

            #region ESPER_8.5.1
            ClassProvidedCompileTimeRegistry = classProvidedCompileTimeRegistry;
            ClassProvidedCompileTimeResolver = classProvidedCompileTimeResolver;
            SerdeEventTypeRegistry = serdeEventTypeRegistry;
            SerdeResolver = serdeResolver;
            IsFireAndForget = fireAndForget;
            #endregion
        }
 public void CompareString()
 {
     ForEachProvider(db => AreEqual(
                         from p in db.Person where p.FirstName == "John" select p,
                         CompilerServices.CompareString(db)));
 }
        /// <summary>
        /// Builds a type name for the specified generic type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="isDynamic">Specifies whether the type is dynamic.</param>
        /// <returns>
        /// The string typename (including namespace and generic type parameters).
        /// </returns>
        public override string BuildTypeNameInternal(Type type, bool isDynamic)
        {
            if (!type.IsGenericType)
            {
                return(type.FullName);
            }

            return(type.Namespace
                   + "."
                   + type.Name.Substring(0, type.Name.IndexOf('`'))
                   + "<"
                   + (isDynamic ? "dynamic" : string.Join(", ", type.GetGenericArguments().Select(t => BuildTypeNameInternal(t, CompilerServices.IsDynamicType(t)))))
                   + ">");
        }
Esempio n. 25
0
 public ModuleCompileTimeServices(
     IContainer container,
     CompilerServices compilerServices,
     Configuration configuration,
     ContextCompileTimeRegistry contextCompileTimeRegistry,
     ContextCompileTimeResolver contextCompileTimeResolver,
     BeanEventTypeStemService beanEventTypeStemService,
     BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate,
     DatabaseConfigServiceCompileTime databaseConfigServiceCompileTime,
     ImportServiceCompileTime importService,
     ExprDeclaredCompileTimeRegistry exprDeclaredCompileTimeRegistry,
     ExprDeclaredCompileTimeResolver exprDeclaredCompileTimeResolver,
     EventTypeAvroHandler eventTypeAvroHandler,
     EventTypeCompileTimeRegistry eventTypeCompileTimeRegistry,
     EventTypeCompileTimeResolver eventTypeCompileTimeResolver,
     EventTypeRepositoryImpl eventTypeRepositoryPreconfigured,
     IndexCompileTimeRegistry indexCompileTimeRegistry,
     ModuleDependenciesCompileTime moduleDependencies,
     ModuleAccessModifierService moduleVisibilityRules,
     NamedWindowCompileTimeResolver namedWindowCompileTimeResolver,
     NamedWindowCompileTimeRegistry namedWindowCompileTimeRegistry,
     PatternObjectResolutionService patternObjectResolutionService,
     ScriptCompileTimeRegistry scriptCompileTimeRegistry,
     ScriptCompileTimeResolver scriptCompileTimeResolver,
     ScriptServiceCompileTime scriptServiceCompileTime,
     TableCompileTimeRegistry tableCompileTimeRegistry,
     TableCompileTimeResolver tableCompileTimeResolver,
     VariableCompileTimeRegistry variableCompileTimeRegistry,
     VariableCompileTimeResolver variableCompileTimeResolver,
     ViewResolutionService viewResolutionService,
     XMLFragmentEventTypeFactory xmlFragmentEventTypeFactory)
 {
     Container = container;
     CompilerServices = compilerServices;
     Configuration = configuration;
     ContextCompileTimeRegistry = contextCompileTimeRegistry;
     ContextCompileTimeResolver = contextCompileTimeResolver;
     BeanEventTypeStemService = beanEventTypeStemService;
     BeanEventTypeFactoryPrivate = beanEventTypeFactoryPrivate;
     DatabaseConfigServiceCompileTime = databaseConfigServiceCompileTime;
     ImportServiceCompileTime = importService;
     ExprDeclaredCompileTimeRegistry = exprDeclaredCompileTimeRegistry;
     ExprDeclaredCompileTimeResolver = exprDeclaredCompileTimeResolver;
     EventTypeAvroHandler = eventTypeAvroHandler;
     EventTypeCompileTimeRegistry = eventTypeCompileTimeRegistry;
     EventTypeCompileTimeResolver = eventTypeCompileTimeResolver;
     EventTypeRepositoryPreconfigured = eventTypeRepositoryPreconfigured;
     IndexCompileTimeRegistry = indexCompileTimeRegistry;
     ModuleDependencies = moduleDependencies;
     ModuleVisibilityRules = moduleVisibilityRules;
     NamedWindowCompileTimeResolver = namedWindowCompileTimeResolver;
     NamedWindowCompileTimeRegistry = namedWindowCompileTimeRegistry;
     PatternObjectResolutionService = patternObjectResolutionService;
     ScriptServiceCompileTime = scriptServiceCompileTime;
     ScriptCompileTimeRegistry = scriptCompileTimeRegistry;
     ScriptCompileTimeResolver = scriptCompileTimeResolver;
     TableCompileTimeRegistry = tableCompileTimeRegistry;
     TableCompileTimeResolver = tableCompileTimeResolver;
     VariableCompileTimeRegistry = variableCompileTimeRegistry;
     VariableCompileTimeResolver = variableCompileTimeResolver;
     ViewResolutionService = viewResolutionService;
     XmlFragmentEventTypeFactory = xmlFragmentEventTypeFactory;
 }