How to create your own Fluent API in C#

preview_player
Показать описание

Hello everybody I'm Nick and in this video I am going to show you how you can create your own Fluent API in C# and .NET. This is one of the many methods you can follow to do it but it's one of my favourites because it gives you the ability to have stages in your fluent building.

Don't forget to comment, like and subscribe :)

Social Media:

#csharp #dotnet
Рекомендации по теме
Комментарии
Автор

Remember watching this forever ago, but for some reason, didn't have it liked!? Re-watched and worth the like!

owns
Автор

Great video! I did the simple method for creating a fluent API for generating test data for our unit tests, which the other engineers love. But I really like your more controlled way of forcing them down a particular path. With the way mine currently is, the developer could create bad data. I may have to update it now!

brianm
Автор

Thank you, Nick! This video inspired me to create the M31.FluentAPI library. It uses source code generation to create the builder boilerplate. Keep up the great work!

mcoding
Автор

This is technical gold. Library and application authors will have a good time using these builder and config pattern techniques. Thanks Nick!

drac.
Автор

Very glad you included the final bit on the lambda-syntax bit some APIs use, always been curious how to implement it!

jackkendall
Автор

Great idea using segmentation by seperating the responsibilities to seperate interfaces; leads to a much more fluent (and predictable) use.

aborum
Автор

For those of you having difficulty wrapping your head around understanding the invoking of the configuration:
Think of the Action<T> as a builder for whatever you replace T with.
You're effectively presenting the user with a way to initialize the object.
Then you're applying that initialization to an existing object, filling it with whatever was entered into the builder.

d-kay
Автор

I never realized I wanted to use this pattern until this video. Awesome!

thatcreole
Автор

works great for creating test data for complex object as well. thanks for sharing, when i found out you could do this stuff, it really changed the way i approach writing parts of my projects

kaiserbergin
Автор

This is my first ever comment on YouTube. And I make this effort to thank you. Your content rocks!!!

SadPraetorchannel
Автор

I definitely agree with who says that for example like this the builder pattern is unneeded boilerplate. It can have a reason only with branches and optional steps. In this simple case a factory method is all you need

reveme
Автор

Awesome demonstration! Will defo use this approach from now on.

michaelhochriegl
Автор

pure piece of mastery. learned a nice trick from you today <3

imranketamashay
Автор

Love the second method. Never thought of that!
Thanks a bunch Nick.

aweklin
Автор

similar concept but a different approach could be achieved by using extension methods... not so safe and intuitive as your solution, but it's a wrapper we could use to create a fluent API around a third party code we are using.
great video Nick!

kano
Автор

I've been trying to implement something like for some time and was the missing piece of the puzzle, THANK YOU.

alexvanheerden
Автор

I've been looking for this for so long! Thank you so much, Nick!

LOrealHardly
Автор

Man, your content is awesome! thank you for creating these videos.

hesamkalhor
Автор

always wondered how this was done. Thanks Nick.

edmonddantes
Автор

Your content is such a master piece always worth watching

pedroxpdo
join shbcf.ru