Coder Social home page Coder Social logo

geewee / boilerplatefree Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 110 KB

Remove boilerplate via C# 9 source generators and attributes. Allows you to auto-generate interfaces from classes, constructors from fields and more

License: MIT License

C# 100.00%
csharp csharp-sourcegenerator

boilerplatefree's People

Contributors

dependabot[bot] avatar geewee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

boilerplatefree's Issues

AutoGenerateInterface

Describe the bug

AutoGenerateInterface generates just for methods, not for properties

Steps to reproduce

 [AutoGenerateInterface]
 public class Person: IPerson
 {
     public void Foo()
     {
         Console.WriteLine("Foo");
     }
     //dummy
     private string s { get; set; }
     public int ID { get; set; }
     public string Name { get; set; }
     //dummy
     public static string NewID { get; set; }
 }

Expected behaviour

 public interface IPerson {

         public void Foo(); 

//please add ID and Name
 }

AutoGenerateInterface Does not work with .NET 6 namespaces

Describe the bug

namespace NetTilt.Auth;
    [AutoGenerateInterface]
    public class AuthUrl : IAuthUrl
    {
    public int? Decrypt(string token){
     
    }
    }

raises an error and does not generate the interface.

Steps to reproduce

See above example

Expected behaviour

generate interface IAuthUrl with Decrypt function

Generation of Constructor for HostServices-Service not working

Describe the bug

As a java developer, I want to have lombok feeling in c# .NET applications, so I decided to have boilerplatefree in my applications.

When I integrate boilerplatefree, the attribute "AutoGenerateConstructor" won't work with transient services. The injected dependencies are not initiated, so when using these dependencies, I receive a System.NullReferenceException.

Code Examples:

[AutoGenerateConstructor]
    public partial class TestService
    {
        private readonly TestRepository _testRepository;
        private readonly Logger<TestService> _logger;

        public void runService()
        {
            var testData = _testRepository.getTestData();
            _logger.LogInformation("giving out testdata: {}", testData);
        }
    }

When calling this service, my expectation is that _testRepository has been initiated by AutoGenerateConstructor.

Steps to reproduce

Check out Project: https://github.com/angerhard/BoilerPlateFreeTesting
Start Program.cs

Expected behaviour

Console should write out

giving out testData: some-test-data

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.