code-generation

Visual Studio Architecture Code Generation - Create List<type> rather than IEnumerable<type>

孤人 提交于 2019-12-21 14:52:10
问题 Is it possible to configure an Association in a Visual Studio (2013) class diagram so that when the code is generated from it that it creates a property with type List<MyClass> or even ICollection<MyClass> rather than it's default of IEnumerable<MyClass> ? 回答1: Yes, it is possible to change the output. Visual Studio uses T4 templates to generate code from the Architecture tools. You can find the templates at C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft

Visual Studio Architecture Code Generation - Create List<type> rather than IEnumerable<type>

断了今生、忘了曾经 提交于 2019-12-21 14:52:08
问题 Is it possible to configure an Association in a Visual Studio (2013) class diagram so that when the code is generated from it that it creates a property with type List<MyClass> or even ICollection<MyClass> rather than it's default of IEnumerable<MyClass> ? 回答1: Yes, it is possible to change the output. Visual Studio uses T4 templates to generate code from the Architecture tools. You can find the templates at C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft

Clojure doseq generates huge code?

China☆狼群 提交于 2019-12-21 13:19:10
问题 I've recently been playing with clojure and reached a problem that I'm not sure how to handle. I have a doseq with 7 parameters and it expands to a huge block, almost passing the maximum class size. Why does doseq expand to such a huge block of clojure code? Example: (def q '(doseq [p0 (nth (:params operator) 0 (quote (nil))) p1 (nth (:params operator) 1 (quote (nil))) p2 (nth (:params operator) 2 (quote (nil))) p3 (nth (:params operator) 3 (quote (nil))) p4 (nth (:params operator) 4 (quote

Clojure doseq generates huge code?

柔情痞子 提交于 2019-12-21 13:19:00
问题 I've recently been playing with clojure and reached a problem that I'm not sure how to handle. I have a doseq with 7 parameters and it expands to a huge block, almost passing the maximum class size. Why does doseq expand to such a huge block of clojure code? Example: (def q '(doseq [p0 (nth (:params operator) 0 (quote (nil))) p1 (nth (:params operator) 1 (quote (nil))) p2 (nth (:params operator) 2 (quote (nil))) p3 (nth (:params operator) 3 (quote (nil))) p4 (nth (:params operator) 4 (quote

Why Haven't GWT- and Script#-style Frameworks Become Dominant?

霸气de小男生 提交于 2019-12-21 09:32:45
问题 With GWT, we can write code in Java and have it translated to JavaScript code. With Script#, we can write code in C# and have it translated to JavaScript code. It sounds GWT and Script# will save web developers from suffering javascript pains. Then, why these tools haven't been dominant? Why still people dedicated to write javascript code? 回答1: Multiple reasons, and which one is most important differs from developer to deverloper. Here are two: Because JavaScript is a more nice/flexible

Why Haven't GWT- and Script#-style Frameworks Become Dominant?

被刻印的时光 ゝ 提交于 2019-12-21 09:32:37
问题 With GWT, we can write code in Java and have it translated to JavaScript code. With Script#, we can write code in C# and have it translated to JavaScript code. It sounds GWT and Script# will save web developers from suffering javascript pains. Then, why these tools haven't been dominant? Why still people dedicated to write javascript code? 回答1: Multiple reasons, and which one is most important differs from developer to deverloper. Here are two: Because JavaScript is a more nice/flexible

XSD to Delphi Classes without XML binding

五迷三道 提交于 2019-12-21 07:22:09
问题 Perhaps this has been asked before, but I haven't found it with regards to Delphi - I have used a XSD.exe in Visual Studio that does exactly this: converts XSD into 'plain vanilla' classes representing the entities specified in the XSD - not bound to XML document - classes for creating the structures in the XSD, not accessing data that conforms to the structure outlined in the XSD. I am looking for a utility or product that will do this (that doesn't cost big bucks...) : Example, I have a

How can i get enum to contain a dash (-)?

拈花ヽ惹草 提交于 2019-12-21 07:12:24
问题 I'm generating business objects from this schema using Enterprise Architect. The schema has the following enumeration specification: <xs:simpleType name="PackageMedium"> <xs:restriction base="xs:string"> <xs:enumeration value="NTP"/> <xs:enumeration value="DAT"/> <xs:enumeration value="Exabyte"/> <xs:enumeration value="CD-ROM"/> <xs:enumeration value="DLT"/> <xs:enumeration value="D1"/> <xs:enumeration value="DVD"/> <xs:enumeration value="BD"/> <xs:enumeration value="LTO"/> <xs:enumeration

Dynamically create a class by interface

拥有回忆 提交于 2019-12-21 04:51:45
问题 I have some expirience with .Net Expressions , when I'm able to dynamically generate methods. It's fine, it's good. But now I need to generate a whole class, and it seems that the only way to do it is Emit whole IL which is totally inacceptable (it's impossible to support). Assume we have following interface: public interface IFoo { [Description("5")] int Bar(); [Description("true")] bool Baz(); } which should be converted to: public class Foo : IFoo { public int Bar() => 5; public bool Baz()

Automatically Generate C Code From Header

风流意气都作罢 提交于 2019-12-21 04:18:27
问题 I want to generate empty implementations of procedures defined in a header file. Ideally they should return NULL for pointers, 0 for integers, etc, and, in an ideal world, also print to stderr which function was called. The motivation for this is the need to implement a wrapper that adapts a subset of a complex, existing API (the header file) to another library. Only a small number of the procedures in the API need to be delegated, but it's not clear which ones. So I hope to use an iterative