geewee / boilerplatefree Goto Github PK
View Code? Open in Web Editor NEWRemove boilerplate via C# 9 source generators and attributes. Allows you to auto-generate interfaces from classes, constructors from fields and more
License: MIT License
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
AutoGenerateInterface generates just for methods, not for properties
[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; }
}
public interface IPerson {
public void Foo();
//please add ID and Name
}
namespace NetTilt.Auth;
[AutoGenerateInterface]
public class AuthUrl : IAuthUrl
{
public int? Decrypt(string token){
}
}
raises an error and does not generate the interface.
See above example
generate interface IAuthUrl with Decrypt function
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.
Check out Project: https://github.com/angerhard/BoilerPlateFreeTesting
Start Program.cs
Console should write out
giving out testData: some-test-data
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.