code-generation

Should I store generated code in source control

This is a debate I'm taking a part in. I would like to get more opinions and points of view. We have some classes that are generated in build time to handle DB operations (in This specific case, with SubSonic, but I don't think it is very important for the question). The generation is set as a pre-build step in Visual Studio. So every t...

code generation tool for ORM mapping

There seems to be no end of code generation tools out there and would rather not have to go through each to see what is still maintained, easy to use, and provides customization. The code generation is for NHibernate mapping and subsequent creation of value objects or Data Transfer objects (DTO). It would be great if it could also gener...

Is there an ORM that can dynamically generate a DAL from within a .Net WinForms app?

I'd greatly appreciate your advice on a strange specification. We have a requirement to create an application where users can drag/drop field types onto a form so that they can create their own "app". I have the front-end setup, but the back-end is a big problem. There are forward mapping ORMs and reverse mapping ORMs, yet I've not ...

How to auto-generate logger calls into source code in C#?

What i'd like to generate into method bodies: private void SomeMethod() { Logger.Log("Entering SomeMethod."); // do stuff here Logger.Log("Exiting SomeMethod.") } Is there a tool which can generate that for me? If there isn't, and I'd like to implement one myself, then where do I start, which library should I look into for recogniz...

Serializing a CodeDom as XML

Is there a way to serialize a CodeCompileUnit object as XML. The problem is that: XmlSerializer xml = new XmlSerializer( typeof(CodeCompileUnit) ); throws the following exception: "Cannot serialize member System.CodeDom.CodeObject.UserData of type System.Collections.IDictionary, because it implements IDictionary." ...

x86 code generator framework for Delphi

Has anyone come across a framework or library for Delphi to simplify the generation of x86 code? I am not looking for an assembler, but rather a framework that abstracts the code generation process above the low level bits and bytes. Ideally I would like to build on top of an existing library or framework rather than hardcode the logic o...

What part (specifically) of a native executable makes it non-portable?

This sounds like a daft question at first, but bear with me. It is common knowledge that binaries for one CPU architecture do not run on others. So for example it is impossible to run (without a compatibility layer of some kind), an x86 binary on a sparc64 chip. The instruction sets are different, so clearly that will not work. But whe...

Manually written business objects or using DAL objects?

Suppose you have three tiers (with namespaces): User interface (App.UI) - calls business layer processes and communicates using objects Business layer (App.Core) - orchestrates processes and uses DAL layer using objects DAL (App.Data) - directly manipulates store and persists objects Let's say that you have User table and thus reflec...

A good place to put autogenerated code?

We have bunch of autogenerated classes which are mostly Axis2 stubs, skeletons etc. For some complicated wsdls, Axis2 generates a TON of java-beans, stubs etc. And I am sure there are other cases too when auto generation is used. For now we treat these as other first class members of our code-base and they are stored in the same package...

SmartCode code generator fails to determine SQL types from MySQL

I am using a code generator called SmartCode Studio to generate the database layer for a ASP.NET application. The generated code uses NHibernate to talk to the database. This has worked well in the past when we used SQL Server. SmartCode retrieves the SQL data types from the database and determines the correct corresponding .NET data ty...

Generating nested routes in a custom generator

I'm building a generator in rails that generates a frontend and admin controller then adds the routes to the routes file. I can get the frontend working with this: m.route_resources controller_file_name but I can't figure out how to do the same for the nested admin route (admin/controller_file_name). Anyone know how to generate these ...

C++ Code Generation

In my epic quest of making C++ do things it shouldn't, I am trying to put together a compile time generated class. Based on a preprocessor definition, such as (rough concept) CLASS_BEGIN(Name) RECORD(xyz) RECORD(abc) RECORD_GROUP(GroupName) RECORD_GROUP_RECORD(foo) RECORD_GROUP_RECORD(bar) END...

GenWise: Round trip code generation for nHibernate

I have been experimenting with GenWise and CodeSmith. I am looking for a tool that will: a) let me edit the data schema in SQL Server SSMS b) generate all the C# objects, xml etc from the database c) have lots of control over the genrated XML and C# d) do the "right thing" when generating code so that I can use the tool iteratively. ...

What are some popular code generation engines?

I've been using some Sonic and NHibernate and NetTiers. What else is out there and how do they compare? ...

How to: compile generated C++ source files?

Hi, so I'm writing a VS2008 C# Add-In to automate AspectC++ weaving in C++ projects. I'm generating the C++ source files (now woven with aspects), but I can't figure out how to compile them as part of the pre-build step. Is there a convenient way to specify new source within the IDTExtensibility2, EnvDTE90, or VslangProj90 namespaces? ...

Are there Decorators / Macros / Annotations in AS 3?

I'm looking for the equivalent of Python decorators / Lisp macros / Java annotations (yes, I know that these are not necessarily equivalent themselves) in Actionscript. Tools that provide similar features would also be great (I'm using the Flex Builder plugin for Eclipse on Linux). I'm writing a Flex application and here's what I want t...

How do I add switches to a custom Rails generator?

Part of the generator I am writing isn't needed in all circumstances, so I need to add a switch so that I can specify whether it is run - something similar to the --skip_migration switch. How should I go about implementing this? ...

Is there something like JET (Java Emitter Templates) but without Eclipse-dependencies?

Hello! I wanted to use JET (Java Emitter Templates) in my Netbeans projects, but had to find out that JET heavily depends on Eclipse libraries. Is there something similar to JET, but as a standalone project? Something which is open source and well maintained? Futhermore, is "code generation" the common term for such tools? I didn't fi...

Code generation from database with Rails

Hi, I use Qcodo/Qcubed in PHP as PHP5 framework. I am interested in Ruby on Rails, but as my first RoR web app I have to use an existing database (web app with PHP4). I know that RoR is a DSL and everything can be created from your defined doamin, but is it possible to do the reverse engineering? I just need, to start, to generate a ba...

How do I execute ruby template files (ERB) without a web server from command line?

Hello! I need ERB (Ruby's templating system) for templating of non-HTML files. (Instead, I want to use it for source files such as .java, .cs, ...) How do I "execute" Ruby templates from command line? ...