@cyber_razz You can make ssh and telnet run over other ports so blocking a port doesn't necessarily deny a particular service π¬ if you wanted to block the default telnet port and allow the default ssh port tho your deny rule would be for tcp port 23.
@kristijan_kralj Really well I often see the opposite. No layers giant 1000 line methods everything is static. Then we have a large tech refresh or migration from vb to c# or migration from web forms to something newer....
And then my friend youll wish someone had of put some layers in there!
Did you know that bees sleep between 5-8 hours a day, sometimes in flowers? Also, they like to sleep with other bees and hold each otherβs feet.
πΈ: Joe Neely
FluentValidation is one of the most powerful validation libraries in .NET.
In 2 minutes, I'll teach you how to start using it like a Pro.
FluentValidation uses a fluent interface and lambda expressions for building strongly typed validation rules.
You start by inheriting from the AbstractValidator<T> base class.
To specify a validation rule for a particular property, call the RuleFor method.
From there, you can write rules ensuring properties are:
- Not null
- Not empty
- Have a min/max length
- Are equal/not equal to some value
- Define your completely custom rules
It also supports complex properties and collections.
It's easy to write asynchronous validation rules using the MustAsync method.
What about dependency injection? It works out of the box.
To run the validation, you call the Validate method, which returns a ValidationResult.
The ValidationResult tells you if the validation passed and if there are any errors.
Likewise, you will call the ValidateAsync method if you have async validation.
P.S. If you liked this, consider joining The .NET Weekly - my newsletter with 40,000+ engineers that teaches you how to improve at .NET and software architecture.
Subscribe here β https://t.co/lQs9X4ci61
Are you using FluentValidation in your projects?
CQRS = Separate read/write databases?
Not so fast! β
This isn't really what CQRS is about.
First, there was the CQS - Command-Query Separation principle.
Here's what CQS is:
- Commands change state, don't return data
- Queries don't change state, return data
- Queries should not have side effects
What? I can't return data from a command?!
Of course, you can - but the intent is different.
I'm not saying you shouldn't be pragmatic.
For example, you insert a new row into the database and return the ID. Perfectly fine.
But what about CQRS?
CQRS stands for Command-Query Responsibility Segregation.
It's an evolution of CQS and works on the architecture level.
Whereas CQS works on the method (or class) level.
It separates the code responsible for handling commands from the code for handling queries.
In other words, you have a logical separation of reads and writes.
You can also extend this with different logical data models.
Here are a few benefits you get with CQRS:
- Complexity management
- Scalability
- Flexibility
- Security
How did we begin associating CQRS with separate read/write databases?
This happens when you take the logical separation of commands and queries and elevate it to physical separation.
There are many flavors of this approach:
- Event sourcing + NoSQL
- SQL + NoSQL
- SQL + Redis
And while it has its benefits, like improving your job security, too much complexity can hurt your project.
So start simple. You can do CQRS with one database.
Apply logical separation of commands and queries.
Only add further complexity if you need to.
P.S. If you liked this, consider joining The .NET Weekly - my newsletter with 40,000+ engineers that teaches you how to improve at .NET and software architecture.
Subscribe here β https://t.co/lQs9X4ci61
Would you use CQRS in your project, or do you view it as over-engineering?
We won peeps! Deborah Mailman Rachel griffiths and #totalcontroltv won best actress and supporting actress and best drama series. We are so thrilled to have made this for Australia. @ABCTV
People often accuse those w/#MECFS of being malingerers, lazy, fakers.
Most of us were athletic, high functioning people who loved living our lives.
#MyalgicEncephalomyelitis took that all away and then, almost blanket abuse by medical 'professionals' began.