code-generation

T4 code generation without Visual Studio 2010?

瘦欲@ 提交于 2019-12-04 09:00:58
Is it possible to run T4 code generation without needing Visual Studio 2010? Basically I have to build an in house ORM (don't ask..if I had a choice I wouldn't). I was planning to use subsonic as a base but change some things and how they work. However my main question is can I run T4 from an external application that I write, so I can use the features of T4? Or am I better off doing it myself (which I doubt)? Michael Maddox TextTransform.exe will do what you want for simple scenarios: http://msdn.microsoft.com/en-us/library/bb126245.aspx Here is how to run a T4 template from your own code for

Using T4 Templates to Generate multiple classes based on POCO

笑着哭i 提交于 2019-12-04 08:44:47
问题 Im looking for a way to increase productivity when I add a table to my database. Generally, when I add a new table I have to perform the following steps. Add table to the database (simple) Create the corresponding EF Code First class. (i dont use db migrations) Create a POCO model that matches the EF class created in #2. Create repository class Create Commands and Handlers for CQRS pattern Create AutoMapper maps for the newly created classes I recently created a new website where the

How to efficiently implement closures in LLVM IR?

我只是一个虾纸丫 提交于 2019-12-04 08:18:04
问题 I started adding closures (lambdas) to my language that uses LLVM as the backend. I have implemented them for simple cases where they can be always inlined i.e. code for the closure definition itself doesn't need to be generated, as it is inlined where used. But how to generate the code for a closure in case the closure isn't always inlined (for example, it is passed to another function that isn't inlined). Preferably, the call sites shouldn't care whether they are passed regular functions or

Dynamic code generation

眉间皱痕 提交于 2019-12-04 08:00:29
I am currently developing an application where you can create "programs" with it without writing source code, just click&play if you like. Now the question is how do I generate an executable program from my data model. There are many possibilities but I am not sure which one is the best for me. I need to generate assemblies with classes and namespace and everything which can be part of the application. CodeDOM class: I heard of lots of limitations and bugs of this class. I need to create attributes on method parameters and return values. Is this supported? Create C# source code

Visual Studio custom tool for code generation… how do I find out what's going wrong?

冷暖自知 提交于 2019-12-04 07:15:24
I'm trying to create a custom tool for code generation in Visual Studio 2010. First I register it: "$(FrameworkSDKDir)Bin\NETFX 4.0 Tools\gacutil.exe" /if "$(TargetPath)" Then I add it via a reg key: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{6A96476E-74F3-4AB3-9CCA-F15EC6104D84}] "RuntimeVersion"="v4.0.30319" "Class"="MapBuildTool.MapFileGenerator" "Assembly"="MapBuildTool, Version=1.0.0.0, Culture=en-US, PublicKeyToken=7d8abca94a1e38ae" "ThreadingModel"="Both" "InprocServer32"="C:\\Windows\\SysWOW64\\mscoree.dll" @="MapBuildTool" [HKEY_LOCAL_MACHINE\SOFTWARE

How to create Clojure `defn` functions automatically without macros?

馋奶兔 提交于 2019-12-04 06:41:49
问题 Originally motivated by the following question: Mapped calls to clojurescript macro Suppose you want to create many similar functions automatically (i.e. without hand-writing them all). Suppose we have some pre-existing functions and we want wrap them with handlers for a callback of some sort: (defn do-foo [] (println "I foo'ed")) (defn do-bar [] (println "I bar'ed")) (defn do-baz [] (println "I baz'ed")) (defn manual-on-foo [] (do-foo)) (defn manual-on-bar [] (do-bar)) (defn manual-on-baz []

JIBX: Classes generated from maven codegen plugin : No unmarshaller for element

早过忘川 提交于 2019-12-04 06:23:58
问题 I use Jibx CodeGen maven Plugin to generate java sources and binding from xsd files. I want to maintain several versions of the xsd in the same applications so I plan to generate to a different target package depending the version of the XSD. JBix seems to generate java package based on the namespaces of the xsd files. ie. for namespace http://www.example.jibx.org/generated/v30/types it generates package org.jibx.example.generated.v30.types During maven build code generation seems to work and

Visual Studio XSD Tool: Generate Collections Rather Than Arrays

萝らか妹 提交于 2019-12-04 04:16:09
I generated some C# classes from an XSD using the Visual Studio XSD utility and it generated arrays for storing a collection of elements, rather than one of the built-in generic Collection<T> (or related) classes. None of the command line parameters mentioned in xsd /? mention anything about generating collections rather than arrays, but I know that this can be done with web service proxy classes that Visual Studio generates, so I figured it must be possible. Does anybody know how to have the XSD utility generate collection classes rather than arrays? Found this post when searching for an

Save generated code in a special folder in “rtwbuild”

我的未来我决定 提交于 2019-12-04 04:03:31
问题 I am using rtwbuild to generated C++ code from a Simulation diagrams and would like to save generated code to an arbitrary directory. Is there any way to do so? 回答1: You can control the folder for generated files in 3 different ways. You can set the "Code generation folder" option in Simulink Preferences. You can reach to Simulink preferences from any model using File menu and then choosing Simulink Preferences. This will change the code generation location for all models and will persist

functions vs repeated code

隐身守侯 提交于 2019-12-04 03:59:01
I am writing some PHP code to create PDFs using the FPDF library. And I basically use the same 4 lines of code to print every line of the document. I was wondering which is more efficient, repeating these 4 lines over and over, or would making it into a function be better? I'm curious because it feels like a function would have a larger overhead becuse the function would only be 4 lines long. The code I am questioning looks like this: $pdf->checkIfPageBreakNeeded($lineheight * 2, true); $text = ' label'; $pdf->MultiCell(0, $lineheight, $text, 1, 'L', 1); $text = $valueFromForm; $pdf->MultiCell