mjfreelancing / alloverit Goto Github PK
View Code? Open in Web Editor NEWA suite of libraries aimed at providing a simplified and consistent approach to cross-cutting and functional concerns.
License: MIT License
A suite of libraries aimed at providing a simplified and consistent approach to cross-cutting and functional concerns.
License: MIT License
At current, the DoubleExtensions class has a defined constant const double Epsilon = 1E-07
.
I propose removing it to use the build-in double.Epsilon
, then adding overloads to allow for custom variance, which seems to be the more modern approach in many other libraries.
This old post on StackOverflow describes that:
The
System.Double
type can represent values accurate to up to 15 digits. So a simple first order estimate if a double valuex
is equal to some constant is to use an epsilon of constant * 1E-15
Another post on the same thread suggests their own implementation, should you wish to keep a default variance:
/// <summary>
/// smallest such that 1.0+EpsilonD != 1.0
/// </summary>
public const double EpsilonD = 2.2204460492503131e-016;
Describe the bug
.NET uses the Options Pattern to provide configuration.
The D2ErdGenerator
constructor requires an "ErdOptions" class. However, it does not accept an IOptions<ErdOptions>
or similar. This means that it cannot be instantiated by dependency injection without hacks.
To Reproduce
Steps to reproduce the behavior:
builder.Services.Configure<ErdOptions>(options => {});
builder.Services.AddSingleton(D2ErdGenerator)();
app.MapGet("/DbDiagram", (D2ErdGenerator generator, MyDbContext dbContext) => generator.Generate(dbContext));
Expected behavior
The ERD string is generated.
** Actual behavior**
Crashes.
Additional context
This can be hacked around with the following: builder.Services.AddTransient( serviceProvider => serviceProvider.GetRequiredService<IOptions<ErdOptions>>().Value );
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.