There is a newer version of this package available.
See the version list below for details.
dotnet new install iQuarc.Geco.CSharp::
This package contains a .NET Template Package you can call from the shell/command line.

Geco, (Ge)nerator (Co)nsole

Simple code generator based on a console project, running on .Net core and using C# interpolated strings.


Geco can be installed as dotnet new template. Run the following command on a consoele or terminal:

dotnet new -i iQuarc.Geco.CSharp

Then create a new project using the newly installed template:

dotnet new geco

Code Generation examples

From the included Entity Framework Core Reverse model generator:

Geco Preview1

From the included SQL Seeed Scrip Generator:

Geco Preview2

Runing geco in interactive mode: Geco Preview3


Geco uses C# string interpolation as a template engine for code generation, in order to allow:

  • Easy cusomization of templates (Simply edit the .cs file)
  • Easy degugging (Place a breakpoint an run)
  • Easy extensibility (Add a new task by creating a new C# class a simple interface IRunnable

Geco uses task discovery at runtime and each task is configured using Dependency Injection. The generation taks can be run during build or from interactive mode (Debug Run).

Included generators

The following generator tasks are included in current version.

  • Entity Framework Reverse model generator
  • SQL Seed data script generator (Generates MERGE scripts)
  • SQL Script runner
  • Database cleaner


  1. The first customization option invoves changing task parameters from appsettings.json configuration file. Each geco task defines it's own set of parameters (see the corespoting Options class):
    "ConnectionStrings": {
        "DefaultConnection": "Integrated Security=True;Initial Catalog=AdventureWorks;Data Source=.\\SQLEXPRESS;"
    "RunAtBuildTasks": [
        "Generate EF Core model"
    "Tasks": [
            "Name": "Generate EF Core model",
            "TaskClass": "Geco.Database.EntityFrameworkCoreReverseModelGenerator",
            "BaseOutputPath": "..\\..\\Generated\\Model\\",
            "OutputToConsole": "false",
            "CleanFilesPattern": "*.cs",
            "Options": {
                "ConnectionName": "DefaultConnection",
                "Namespace": "Model",
                "OneFilePerEntity": true,
                "JsonSerialization": true,
                "GenerateComments": true,
                "UseSqlServer": true,
                "ConfigureWarnings": true,
                "GeneratedCodeAttribute": false,
                "NetCore": true,
  1. By customizing existing templates directly.

  2. By creating new code generation tasks as a C# class which implements the IRunnable interface.

IRunnable is a single method interace containging the Run method:

    /// <summary>
   /// Represents a runable task, for code generation or purposes or others
   /// </summary>
   public interface IRunnable
       /// <summary>
       /// Invoked when this task is executed
       /// </summary>     

A code generation class can be acconpanied by an Option POCO class to hold options which can be customized from appsettings.json


    public class SeedDataGeneratorOptions
        public string ConnectionName { get; set; }
        public string OutputFileName { get; set; }
        public List<string> Tables { get; } = new List<string>();
        public string TablesRegex { get; set; }
        public List<string> ExcludedTables { get; } = new List<string>();
        public string ExcludedTablesRegex { get; set; }
        public int ItemsPerStatement { get; set; } = 1000;
        /// <summary>
    /// Generates seed scripts with merge statements for (Sql Server)
    /// </summary>
    public class SeedDataGenerator : BaseGeneratorWithMetadata
    // ...

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.9 2,766 5/15/2020
1.0.5 1,843 3/21/2018
1.0.4 943 3/6/2018
1.0.3 1,063 1/30/2018
1.0.2 1,098 12/12/2017
1.0.1 962 11/14/2017 902 11/13/2017 1,037 11/7/2017

First Release