code-generation

Add methods to generated WCF client proxy code

I'd like to add one additional method for each service operation in my WCF client proxy code (i.e. the generated class that derives from ClientBase). I have written a Visual Studio extension that has an IOperationContractGenerationExtension implementation, but this interface only seems to expose the ability to modify the service interfa...

Recognizing terminals in a CFG production previously not defined as tokens.

I'm making a generator of LL(1) parsers, my input is a CoCo/R language specification. I've already got a Scanner generator for that input. Suppose I've got the following specification: COMPILER 1 CHARACTERS digit="0123456789". TOKENS number = digit{digit}. decnumber = digit{digit}"."digit{digit}. PRODUCTIONS Expression = Term{"+"...

Is there a tool to generate MVC code in C#?

I was working on a project with a colleague and went out for lunch one day. Given that we only spent a few days doing design and no coding, I was surprised to find out that after lunch, he had over 40 files completed (various classes, interfaces, DTOs, etc). He told me he is just a fast typist but I need to know the real deal. He hasn't...

.Net SvcUtil: attributes must be optional

Hi, I'm trying to generate C# code classes with SvcUtil.exe instead of Xsd.exe. The latter is giving me some problems. Command line: SvcUtil.exe myschema.xsd /dconly /ser:XmlSerializer Several SvcUtil problems are described and solved here: http://blog.shutupandcode.net/?p=761 One problem I can't solve is this one: Error: Type 'Dat...

Auto-generate WebControls

I want to generate .net code from a template so that it more rapid, so lazy developers (and I mean that in the nicest possible way!) don't have to write them in the IDE, compile them, etc... I know I can roll my own tool which generates the code using reflection (by reading in some text file, etc), but I just wondered if there was an ea...

Generation of abstract class with JCodeModel

I'm trying to generate top-level abstract class with JCodeModel library, but I can't find any way to change class modifiers. It's possible for nested classes (JDefinedClass API provides methods that get modifiers as parameters). But for creation of top level classes I found only JCodeModel API methods that get fully qualified name with ...

Generate java code in Eclipse?

Does anyone know what approach one can take to automatically generate Java source code, from for example an xml or json file, in eclipse? One great example of what I am thinking of doing is what Google Android sdk does: they have an R class generated automatically from the resources. Every time a resource file is saved in Eclipse R cla...

How to hide files generated by custom tool in Visual Studio

I would like the files generated by my custom tool to be hidden, but I cannot find any documentation on how this is done. An example of what I'm looking for is WPF code behind files. These files are not displayed in the Visual Studio project view, yet are compiled with the project and are available in IntelliSense. WPF code behind fil...

Parser generator for JavaME

First: I have looked at this SO question but unfortunately there is no mention of JavaME I am looking for a parser/lexer generator that produces code that can run on the Blackberry and its (obnoxious) JavaME. E.g. at first I thought I could use ANTLR however it seems the run-time library is not compatible with JavaME TIA ...

Visual Studio code generated when choosing to explicitly implement interface

Sorry for the vague title, but I'm not sure what this is called. Say I add IDisposable to my class, Visual Studio can create the method stub for me. But it creates the stub like: void IDisposable.Dispose() I don't follow what this syntax is doing. Why do it like this instead of public void Dispose()? And with the first syntax, I coul...

C++ code generation with Python

Can anyone point me to some documentation on how to write scripts in Python (or Perl or any other Linux friendly script language) that generate C++ code from XML or py files from the command line. I'd like to be able to write up some xml files and then run a shell command that reads these files and generates .h files with fully inlined ...

Oddities in Linq-to-SQL generated code related to property change/changing events

I'm working on creating my own Linq-to-Sql generated classes in order to learn the concepts behind it all. I have some questions, if anyone knows the answer to one or more of these I'd be much obliged. The code below, and thus the questions, are from looking at code generated by creating a .DBML file in the Visual Studio 2010 designer,...

How do I generate a constructor from class fields using Visual Studio (and/or ReSharper)?

I've gotten accustomed to many of the Java IDEs (Eclipse, Netbeans, IntelliJ) providing you with a command to generate a default constructor for a class based on the fields in the class. For example: public class Example { public decimal MyNumber { get; set; } public string Description { get; set; } public int SomeInteger ...

C# Class (source code) Generator from XML file

What tools have you used to create class source code from xml files? Is this an edge case that I need to roll my own? I have need to create DTOs from some XML files, but the XML files are subject to change (add/remove attributes) so I need to be able to quickly update them. I'm reallly not impressed with the .xml -> .xsd -> bloated .cs ...

How to best integrate generated code

I am evaluating the use of code generation for my flight simulation project. More specifically there is a requirement to allow "the average engineer" (no offence I am one myself) to define the differential equations that describe the dynamic system in a more natural syntax than C++ provides. The idea is to devise a abstract descriptor la...

Creating C# form fields with events based off of a text file

I need to generate windows form fields based off of a text file that I am parsing. I also want to automatically generate validation event handlers which all will be basically the same only the form field and the regular expression which is used to validate the field will change. I'm having a difficult time figuring out the quickest and...

Is Lightweight Code Generation (LCG) dead?

In the .NET 2.0-3.5 frameworks, LCG (aka the DynamicMethod class) was a decent way to emit lightweight methods at runtime when no class structure was needed to support them. In .NET 4.0, expression trees now support statements and blocks, and as such appear to provide sufficient functionality to build just about any functionality you co...

PHP general form generator/builder

I'm looking for an open source php form builder or form generator to add/edit/delete/search records? I have to create a simple manager for some records, it's a common application that should be found easily, but I can't find any good code/class/application/etc :( Any help is appreciated. ...

Any way to get TStringList.CommaText to not escape commas with quotes?

I'm doing some work with code generation, and one of the things I need to do is create a function call where one of the parameters is a function call, like so: result := Func1(x, y, Func2(a, b, c)); TStringList.CommaText is very useful for generating the parameter lists, but when I traverse the tree to build the outer function call, w...

Insert code into a method - Java

Is there a way to automatically insert code into a method? I have the following typical field with a getter and setter and I would like to insert the indicated code into the setter method that records if the field was modified as well to insert the indicated "isFirstNameModified" field to also track if the field was modified or not. p...