Code Monkey home page Code Monkey logo

cscodegenerator's People

Contributors

borisdj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cscodegenerator's Issues

GetterBody is ignored for Property

model:

serviceClassModel.Properties = new List<Property>
{
    new(BuiltInDataType.String, "UdtName")
    {
        AccessModifier = AccessModifier.Public,
        KeyWords = new List<KeyWord> { KeyWord.Override },
        IsGetOnly = true,
        GetterBody = "foo"
    }
};

output:

public override string UdtName { get; }

expected:

public override string UdtName => "foo";
public override string UdtName
{
    get
    {
        return "foo";
    }
}

Usability Suggestions

  • UsingDirectives shouldn't require using , just add it when writing
  • Namespace shouldn't require namespace, just add it when writing
  • Switch dictionaries to lists for fields, properties, methods, etc. A dictionary doesn't necessarily maintain ordering and requires slightly more code to use. There are other ways to enforce unique names.
  • Remove Console.ReadKey() in CsGenerator. That isn't an expected behavior.
  • Don't use Console.WriteLine and instead use a logging framework, i.e. Microsoft.Extensions.Logging
  • Improve nested class indenting. Having to manually adjust the indent isn't fun and is unexpected.

Improve writing methods

Using a simple list of lines works well enough for very simple methods, but as soon as you add even a single if, it becomes challenging to keep indents correct. Adding some type of fluent builder could go a long way, i.e.

var method = MethodBuilder.Name("Hello")
                       .AddLine("if (some condition)")
                       .AddLine("{")
                       .AddIndent()
                       .AddLine("Console.WriteLine(\"Hello World\");")
                       .RemoveIndent()
                       .AddLine("}")
                       .Build()

or

var method = MethodBuilder.Name("Hello")
                       .AddLine("if (some condition)")
                       .StartScope()
                       .AddLine("Console.WriteLine(\"Hello World\");")
                       .EndScope()
                       .Build()

Should push out new version of the nuget

Hi, you should push out a new version of the nuget with the usability changes in the latest commit. Started using this library now, and was surprised at a couple of things which are corrected in the usability changes you did.

Best,
Stein J. Gran

Comment missing <summary></summary>

Zdravo

Currently Comment renders the following:

    // my comment
    public class MyClass 

I would like Comment to render the following:

    /// <summary>
    /// my comment
    /// </summary>
    public class MyClass

This will allow the generated code to output XML Documentation

Version 1.0.2 Prints out "Press any key to close."

Using Visual Studio 2019. I do not see it in the code base currently, so a bit confused where its coming from, but each time directly after CsGenerator.CreateFiles() the breakpoint does not move on to the next line, and then displays "Press any key to close.".

Not sure if you're seeing the same issue when using the nuget package or not. Otherwise, loving the library so far, and code looks nice and clean.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.