code-generation

How to debug/break in codedom compiled code

和自甴很熟 提交于 2019-11-27 02:11:54
问题 I have an application which loads up c# source files dynamically and runs them as plugins. When I am running the main application in debug mode, is it possible to debug into the dynamic assembly? Obviously setting breakpoints is problematic, since the source is not part of the original project, but should I be able to step into, or break on exceptions for the code? Is there a way to get codedom to generate PDBs for this or something? Here is the code I am using for dynamic compliation.

How can I serialize an object to C# object initializer code?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 01:27:47
问题 I'm looking to take an in-memory object (or JSON serialization of an object) and emit C# code to produce an equivalent object. This would be useful for pulling known-good examples from a repository to use as starting points in unit tests. We have considered deserializing JSON, but C# code would have an edge when it comes to refactoring. 回答1: If your model is simple, you could use reflection and a string builder to output C# directly. I've done this to populate unit test data exactly like you

XSD Code Generator [closed]

浪尽此生 提交于 2019-11-27 01:22:14
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Are there any Code Generators that would take a well-formed XML document, and write out an XSD schema based on how the XML document is

Java source code parsers/generators [closed]

前提是你 提交于 2019-11-27 01:20:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I need tools to: Conveniently parse Java source code and easily access given elements. Easily generate source code files, to easily transform data structures into code Any good tips, libraries, frameworks, tools? Thank you for help. 回答1: Since Java 6, the compiler has an API included in the JDK. Through it you

Creating T4 templates at runtime (build-time)?

巧了我就是萌 提交于 2019-11-27 01:06:24
问题 We are building an inhouse application which needs to generate HTML files for upload into eBay listings. We are looking to use a template engine to generate the HTML files based on database and static fields that we have pre-defined. The template also needs to have logic capabilities (if-then, foreach, etc). We have looked at T4 and it looks perfect, but we don't see anything about whether it has the capabilities to be used at runtime, so that a user can create the T4 template, and then the

Automatically generate C++ file from header?

牧云@^-^@ 提交于 2019-11-27 00:36:36
问题 I have a bunch of C++ header files with various class and function declarations. So far, when I've been writing the C++ source file implementations of the declared classes and functions, I've been manually: Copying the declarations from the header file to the corresponding source file. Deleting "class classname {" and the matching "};" Adding "classname::" onto the names of all the class functions. Replacing the semicolons after the function declarations with "{}". Deleting the keywords

creating a function object from a string

帅比萌擦擦* 提交于 2019-11-26 23:15:55
问题 Question: is there a way to make a function object in python using strings? Info: I'm working on a project which i store data in a sqlite3 server backend. nothing to crazy about that. a DAL class is very commonly done through code generation because the code is so incredibly mundane. But that gave me an idea. In python when a attribute is not found, if you define the function " getattr " it will call that before it errors. so the way I figure it, through a parser and a logic tree I could

Is there away to generate Variables' names dynamically in Java?

被刻印的时光 ゝ 提交于 2019-11-26 23:03:37
Let's say that I need to generate variables to hold some input from the user (I don't know how many they are). Without using Array , ArrayList (and other kind of lists and maps) can my code generate (lets say) String variables X times with names like ( String var001 , String var002 , String var003 , etc)? If yes, please provide sample code. Following is the way that i have implemented and helped me to fix my solution easily without much hurdles. // Creating the array List List accountList = new ArrayList(); for(int k=0;k < counter;k++){ accountList.add(k, (String)flowCtx.getValueAt("transitId"

Can't access Parent's Members while dealing with Macro Annotations

馋奶兔 提交于 2019-11-26 22:18:01
问题 I am kind of blocked with the following ( macro annotation ) situation. Suppose I have an annotation called @factory which aims to generate an apply method for the annotated trait in the corresponding companion object. For instance, given the trait A : @factory trait A { val a1: Int } the expected code to be generated is the following one: object A extends Factory[A] { def apply(_a1: Int) = new A { val a1 = _a1 } } Now suppose we have a trait B which inherits from A : @factory trait B extends

How can I automatically add existing items to a Visual Studio project?

馋奶兔 提交于 2019-11-26 22:00:40
问题 I have a tool which dynamically generates .xaml and .xaml.cs files and puts them in the appropriate Visual Studio directory . To add them to the project, I have to then: right-click on that directory choose "add existing item" navigate to the matching directory on the hard drive select the two files that were created click ok Is there a way for me to tell the project to "include all existing items under the project folder on the hard drive"? 回答1: I do not have any automation for this. Still I