code-generation

.net CodeGenerators?

I need a code generator that: is open source will run in medium trust where templates are either compilable or can be embeded as resource files. Webforms will not work because of 2 and 3. If I use virtual path provider then it runs only in full trust; if I run them as regular webforms, then I have to provide .ascx files witch is not...

How can I codegen classes like this in C#?

I have multiple classes in a project that are exactly the same except for the name of the class. Basically, they represent glorified enums loaded at runtime from config files. The classes look like this: public class ClassName : IEquatable<ClassName> { public ClassName(string description) { Description = description; } ...

WCF Serialization Problem

I'm switching code generators for my business objects. I was using SQL Metal, but in moving to the T4 toolbox's generator, serialization seems to have stopped working, and it looks like the two are doing pretty much the same thing. This is the property generated by SQL Metal (which works): [Association(Name="FK_FamilyConfiguration_Fam...

Simple PHP Crud Generator

I am looking for a simple PHP crud object generator to use with SQL database tables. I've used POG and was wondering if there were any alternatives. ...

Tool for creating Dynamically Generated Code in Java (In Eclipse)

In Visual Studio land, I used to be able to define a structure in an XSD file and add a special attribute to it which would cause it to be dynamically compiled and available to use with intellisense in the other C# files in the application. I am not sure exactly what the term for this is, perhaps "dynamic code generation." I am trying ...

Why won't @override work??

What is wrong with piece of code? @Override protected void onCreate(Bundle savedInstanceState) { Eclipse states that @override cant be where it is. It says that 'Bundle' is wrong. I am lost. ...

code errors copying from a book

The code comes from "Hello Android" Page47. I am using 1.6 since that is what the book is written for. import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; /** Called when the activity is first created. */ e1 @Override e2 publ...

Code generation using .net

are there any classes in the .net framework that allow me to generate classes that i can save as .cs or .vb files ? ...

How to output namespace in T4 templates?

I have a T4 template for a class set up with TextTemplatingFileGenerator Custom Tool in Visual Studio: <#@ template language="C#v3.5" hostspecific="True" debug="True" #> <# var className = System.IO.Path.GetFileNameWithoutExtension(Host.TemplateFile); var namespaceName = "MyNamespace"; #> namespace <#= namespaceName #> { public...

AndroMDA maven code generation and JPA Annotations

I am using the AndroMDA plugin for maven to generate code from an uml diagram made in MagicDraw. When the code is generated, AndroMDA desings the JPA annotation for the persitence layer. I think that at the compilation process AndroMDA uses Naming Strategies to determine the Table and Column names for the DataBase. I want to determine ...

For what purposes have YOU used T4?

T4 has existed for several years in Visual Studio, but doesn't get a lot of attention. However, for those that know it, there seems to be some very creative and useful purposes. I am researching some different ways that T4 is used, and I would appreciate to hear how YOU may have used it for real life scenarios. I am primarily interest...

'CompanyName.Foo' is a 'namespace' but is used like a 'type'

Restatement of the question I'm resurrecting this question because I just ran into this error again today, and I'm still utterly confused why the C# compiler bothers to check for collisions between namespaces and types in contexts where it makes no sense for a namespace to exist. If I have... public Foo MyFoo { get; set; } ...why wo...

Robust Code framework?

I hate writing code that makes my software more solid. This is something the framework should have done! So, is anybody aware of a code "enhancing" utility that solidifies the code? If I had to create something like this myself, it would work as follows: When you're compiling your code with a Debug flag, it would auto-magically add "sol...

Creating a visual studio project directory using T4

I am trying to use T4 for source code generation. Mostly, I am able to generate individual files using it. Can you please provide me some information on how to create a complete visual studio directory (preferably separate from T4 template directory) having the below sample structure: /MyProject – Contains MyProject.sln. /app - Contains...

Minify / Obfuscate PHP Code

Hi, I use haXe to generate php code. (This means you write you code in the haXe language and get a bunch of php files after compiling.) Today a customer told me that he needs a new feature on a old project made with haXe. He also told me that he altered some small things on the code for his own needs. Now I first have port his changes t...

T4: Is it possible to use a script to fill in a template, while still providing sections via the script?

I have a template that generates a class and a complementary interface to go with it from a script like so: <#@ template language="C#v3.5" hostspecific="True" debug="True" #> <#@ output extension="cs" #> <#@ include file="T4Toolbox.tt" #> <#@ include file="../BusinessObjectTemplate.tt" #> <# BusinessObjectTemplate template = new Busines...

How to avoid 'Unknown' data types when generating code with MyGeneration and Oracle 10?

Hello world. I am attempting to generate a dOOdads business entity using MyGeneration against an Oracle database table. ( http://www.mygenerationsoftware.com/portal/dOOdads/Overview/tabid/63/Default.aspx ) The class generator appears to have issues detecting the data types. For instance, PHOTOID is VARCHAR2. The class generated con...

Is there a simple Linq to SQL generator with bi-directional serialization attributes?

I'm trying to find a way to generate Linq to SQL classes with bi-directional serialization attributes. Basically I want a DataMember tag (with an appropriate order) on every association property, not just the ones where the class is the primary key (like the Visual Studio generator and SQL Metal do). I checked MyGeneration, but didn't re...

Sql code formatter for .NET (SQL Server 2008 dialect)

Can you please point me to a an SQL code formatter, preferably as an opensource library for NET? I need to make sql source code invariant to the formatting, because i would like to make consistent diff on version control system merges, and it's not easy to maintain in generated code mixed with snippets of handcrafted code. My idea is t...

Script generation using GUI

Hi, Is there an example for a project a GUI fro script generation? The idea is to let a non-programmer use a front end to enter command and simple logic that will translated to runnable scripts. The programming language does not meter. thanks ...