tagged [code-generation]

Is there a programatic way to identify c# reserved words?

Is there a programatic way to identify c# reserved words? I'm looking for a function like I know I could roll my own by grabbing a reserve word list from MSDN. However I was hoping there was something...

10 Mar at 17:13

T4 Get Current Working Directory of Solution

T4 Get Current Working Directory of Solution I am using T4 in Visual Studio 2010, and I want to iterate over the files in my solution, however I have found that T4 source generation works in a kind of...

4 Dec at 17:55

Generated exception classes with Axis2

Generated exception classes with Axis2 I have several web services in the same package that throw a custom exception. The problem is that the generated exception class contains a reference to the web ...

Reflection.Emit vs CodeDOM

Reflection.Emit vs CodeDOM I am trying to generate some (relatively complicated) dynamic classes in a system based on metadata available at runtime in XML form. I will be generating classes that exten...

Resources for code generation of database objects

Resources for code generation of database objects I am working a project where I need to generate a series of classes to represent/access data in the database. Third party projects such as hibernate o...

Nullable value with xsd.exe generated class

Nullable value with xsd.exe generated class I have been using xsd.exe to generate a class for deserializing XML into. I have decimal value in the source xsd that is not required: The resulting class f...

16 Sep at 15:41

Performance Impact of Generating 100's of Dynamic Methods in Ruby?

Performance Impact of Generating 100's of Dynamic Methods in Ruby? What are the performance issues associated with generating 100's of dynamic methods in Ruby? I've been interested in using the [Ruby ...

17 May at 05:56

Naming convention for generated identifiers in C#

Naming convention for generated identifiers in C# In a lot of autogenerated code in Java, the common practice is to preface the name of variables that could potentially clash with user variables with ...

3 Oct at 21:20

Unable to generate assets to build and debug. OmniSharp server is not running

Unable to generate assets to build and debug. OmniSharp server is not running On Visual Studio (VS) Code, coding on C#. I'm trying to generate assets to build and debug and I'm getting the following e...

Naming Conventions For Partial Class Files

Naming Conventions For Partial Class Files I'm generating the bulk of my ASP.NET MVC scaffolding code. All generated files are partial classes which use standard naming conventions. For example, my em...

How to use T4 to generate two files at the same time from one template?

How to use T4 to generate two files at the same time from one template? I am having a case in which I need to generate two CSharp code files with pretty the same code but different namespace of the in...

suppress warning for generated c# code

suppress warning for generated c# code I have turned on "Treat warnings as errors" for my VS project which mean that I get errors for missing documentation (nice reminder for this particular project)....

Creating T4 templates at runtime (build-time)?

Creating T4 templates at runtime (build-time)? We are building an inhouse application which needs to generate HTML files for upload into eBay listings. We are looking to use a template engine to gener...

21 Feb at 21:40

T4 Generation: Where does VsNamespaceSuggestion() pull from?

T4 Generation: Where does VsNamespaceSuggestion() pull from? Does anybody know, in a .tt file, where code.VsNamespaceSuggestion() gets its namespace from? I'm having an issue where I had to change a ...

Visual Studio 2015 not automatically adding asterisk for multiline comments

Visual Studio 2015 not automatically adding asterisk for multiline comments When typing multi-line comments Visual studio used to add an automatic asterisk to each new line of the comment as I press e...

Comparison of XSD Code Generators

Comparison of XSD Code Generators I'm doing some research in code generation from xsd schema files. My requirements: - - - - (see also my other questions: [How can I generate multiple classes from xsd...

23 May at 12:34

XmlCodeExporter and nullable types

XmlCodeExporter and nullable types `System.Xml.Serialization.XmlCodeExporter` generates code (in code CodeDom form) from an XSD schema. But it does it with some quirks. For example an optional element...

17 Feb at 13:4

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

How can i get enum to contain a dash (-)? I'm generating business objects from [this schema](http://schemas.opengis.net/oseo/1.0/oseo.xsd) using Enterprise Architect. The schema has the following enum...

19 Jan at 21:27

How to debug/break in codedom compiled code

How to debug/break in codedom compiled code I have an application which loads up c# source files dynamically and runs them as plugins. When I am running the main application in debug mode, is it possi...

5 Sep at 15:35

Generating classes automatically from unit tests?

Generating classes automatically from unit tests? I am looking for a tool that can take a unit test, like and generate, automatically, the corresponding stub class and interface ``` interface IPerson ...

1 Apr at 22:23

return only Digits 0-9 from a String

return only Digits 0-9 from a String I need a regular expression that I can use in VBScript and .NET that will return only the numbers that are found in a string. For Example any of the following "str...

How to add parameters to generated method in Roslyn ( Microsoft.CodeAnalysis )? - Need exact syntax

How to add parameters to generated method in Roslyn ( Microsoft.CodeAnalysis )? - Need exact syntax Below is the function I'm using to generate a simple method - ``` //NOTE : SF = SyntaxFactory Li...

Compiling dynamic code at runtime using T4 and C#

Compiling dynamic code at runtime using T4 and C# The articles I have read on T4 using TextTemplatingFilePreprocessor show how to dynamically generate code that becomes part of a project, and is compi...

1 Mar at 19:32

How to auto-generate a C# class file from a JSON string

How to auto-generate a C# class file from a JSON string Given the following JSON object, what is a tool to auto-generate the following C# class? ``` public c

6 Aug at 13:1

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

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](http://en.wikipedia.org/wiki/Eclipse_%28software%29...