code-generation

How to use Brail as a stand-alone general purpose templating engine (like NVelocity)?

Hi, I've been using NVelocity as a stand-alone templating engine in my text file generator. The problem with NVelocity is that the macros are quite shaky; pretty much all errors I get are from faulty macro implementation. It would be cool if I could just use some other templating engine, such as Brail. That way I would just write funct...

Visual Studio XSD Tool: Generate Collections Rather Than Arrays

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, bu...

Good UML designer for Visual Studio 2008 Professional Edition with code generation

What is the cheapest tool I can buy to allow visual UML design that has code generation abilities bearing in mind it's currently Visual Studio Professional, not Team studio. I'm trying to achieve the ability of visually creating the namespaces, classes, main paramters and functions in new developments so I can explain show the class lay...

Escaping C++ code in C# Regex

Im trying to insert literal strings into c++ files using a c# tool, and Im tasked with automatically adding escapes. To start with " => \". However I cannot figure out the regular expression required to transform instances of " to \" public String AddEscapeCharactersForCode(String content) { String escaper = "\\\\"; ...

Database Schema from DomainModel

Hi guys, Does anyone have experience with generating database schema from c# (.net 3.5) domain model? Which of the tools produces the cleanest script? Telerik OpenAccess ORM would have been ok but it doesn't produce clean column names from c# classes if the property fields use .net 3.5 implicit private fields. I just need an initial sc...

What's the best code generator you have used

I recently took a look at MyGeneration, and I think it might be a great tool to use. This was the first time I looked at a code Generator, and I would like to know about your experiences from other products, the pros, the cons and did you consider the tool usefull. I will explain a bit how I plan to use it, so you might be able to answe...

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

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 cod...

Where are the downloadable Rails generators?

When I run... $ script/generate I get a list of installed generators and a message saying "More are available at http://wiki.rubyonrails.org/rails/pages/AvailableGenerators." However, the indicated wiki page says "This topic does not exist yet." Does there exist some central repository of downloadable Rails generators? In particular...

How can I get arrays to have a name other than "Items" when generating C# code from an XSD schema?

I'm working on a project that has to connect to some ancient webservices that pack some hierarchical data for requests and responses into single strings of hierarchical XML. I've been using xsd.exe to generate XSDs from sample request and response XML fragments, modifying them where necessary to be the best possible definition, and usi...

Using a DSL to generate C# Code

Currently the project I'm working with does not have completely fixed models (due to an external influence) and hence I'd like some flexibility in writing them. Currently they are replicated across three different layers of the application (db, web api and client) and each has similar logic in it (ie. validation). I was wondering if the...

Theory, examples of reversible parsers?

Does anyone out there know about examples and the theory behind parsers that will take (maybe) an abstract syntax tree and produce code, instead of vice-versa. Mathematically, at least intuitively, I believe the function of code->AST is reversible, but I'm trying to find work/examples of this... besides the usual resources like the Drago...

Simple CRUD Generator for C#

Hello all, I am looking for a simple CRUD (or DAL) Generator for C#. I don't want anything heavyweight since I only have a couple of tables in a SQL Server 2008 database. Any suggestions? I know .netTiers, but it is way too much for what I need. Thanks! UPDATE: I tried LINQ to SQL and it doesn't work well for my needs. ...

Introducing code generators in a project. Could this be a risk?

I have made a code review for a .NET project (VS2008/.NET 3.5). I noticed that many business entitities and data access components were created from scratch while not having a business demand for implementing complex rocket-science code. Many review-issues were related to the data access layer. Looking at the architecture that is used ...

Anyone have experience calling Rake from MSBuild for code gen and other benefits? How did it go? What are your thoughts / recommendations?

While programming in C# using Visual Studio 2008, I often wish for "automatic" code generation. If possible, I'd like to achieve it by making my MSBuild solution file call out to Rake, which would call Ruby code for the code generation, having the resulting generated files automatically appear in my solution. Here's one business exampl...

C# to format (indent, align) C# properly

We have a code generator that munges the schema of a given database to automate our inhouse n-tier architecture. The output is various C# partial classes, one per file. In the code to munge all the strings, we try and keep on top of the indenting and formatting as much as possible, but invariably when you come to open the file in Vis...

VS: Automatic "ArgumentNull' check ?

It's often the case when I need to check a method's arguments for not being null, something like: public static bool operator <= (ApplicationVersion i_app1, ApplicationVersion i_app2) { if (i_app1 == null) throw new ArgumentNullException("i_app1"); if (i_app2 == null) throw new ArgumentNullException("i_app2"); [...] } ...

How can I tag code as generated

Is it any best practice to tag .net generated code? What I want to achieve is following: Debugger step by default not inside the property or method Metrics are not calulated for those classes/members ...

Is Code Generation a Bad Thing?

This is a subjective question. Recently I have been trying to learn NHibernate. The problem with it is at least 2 fold: mapping xml file that needs to be coded by hand Entity Class that needs manual coding While NHibernate is a wonderful framework, but the need to write mapping file and to create entity classes that mimic the databa...

Convert a Method to C# source Code

I am writing a fairly simple code gen tool, and I need the ability to convert MSIL (or MethodInfo) objects to their C# source. I realize Reflector does a great job of this, but it has the obnoxious "feature" of being UI only. I know I could just generate the C# strings directly, using string.Format to insert the variable portions, but...

How does the Traditional "HTML is only for content" line of thought handle dynamic formatting?

For so long, I've read and understood the following truths concerning web development: HTML is for content CSS is for presentation JavaScript is for behavior. This is normally all fine and good, and I find that when I strictly follow these guidelines and use external .css and .js files, it makes my entire site much much more manageab...