Big changes for version 3 #112
andrebaltieri
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
Use Dictionary instead of ListDo you agree with this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Drop support for older .NET versionsDo you agree with this? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dictionary instead of List
When we designed Flunt, we intend to store entity validations and warnings nested to its object. This is cool, and we looked forward to let you extend your notifications by creating a
Contract<T>
where T is a type of Notification.However, the amount of projects that extends the Notification class is very small. In fact is better to keep less data as possible and most case ends in a key/pair (Of string).
The proposal here is to change from
public IReadOnlyList<T> Notifications { get; }
topublic IReadOnlyDictionary<string, string> Errors { get; }
, making usage ofDictionaries
, which are way faster than generic lists.Downsides
You'll be unable to extend notifications with custom attributes and won't be able to register same key twice or more.
Standalone Contracts
Beside work with notifications for entities, we can use Flunt to validate almost everything. The proposal here is to separete
Contract
fromNotifiable
to increase validation capabilities.Improve base validation
On version 1 we had a contract (interface)
IValidatable
forcing to implementValidate
method. This was removed on version 2 since force some interface to be implemented is just bad.The purpose here is to bring it back, but silently, as a virtual method that you can override.
Drop AddNotification need
To make simple validations inside a class that inherit from
Contract
we needed to do something like:As we merged Notifiable and Contract, will be easier to validate.
Drop support for older .NET versions
We are focusing on performance for this version and .NET 7 is a masterpiece. Strings were restructured to increase performance, Regex had a boost, LINQ was enhanced... there are so many good things about it, that Flunt performance will be increase at least 30% just by moving to .NET 7.
Downsides
.NET versions lower than .NET 7 were not be supported by this version. You can use Flunt V1 and V2, but V3 will be .NET 7 or higher only.
PLEASE VOTE BELOW
Please, share your thoughts and vote (👍 or 👎) on topics below.
Beta Was this translation helpful? Give feedback.
All reactions