![Spyros Katsios](/img/default-banner.jpg)
- 63
- 49 729
Spyros Katsios
Приєднався 7 жов 2022
Hi, my name is Spyros Katsios and I'm a C# Software Engineer.
CI/CD with GitHub Actions: Build & Push Docker Images to Docker Hub
Hi there! Today we are going to see how to build and push a Docker image to Docker Hub, as part of your CI/CD pipeline, using GitHub Workflows.
yaml file:
name: Build and push to Dockerhub
on:
push:
branches:
- main
jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v6.13.0
with:
context: .
file: ./Weather.Api/Dockerfile
push: true
tags: |
repo-name:${{ github.sha }}
repo-name/weather-api:latest
#GitHubActions #Docker
yaml file:
name: Build and push to Dockerhub
on:
push:
branches:
- main
jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v6.13.0
with:
context: .
file: ./Weather.Api/Dockerfile
push: true
tags: |
repo-name:${{ github.sha }}
repo-name/weather-api:latest
#GitHubActions #Docker
Переглядів: 112
Відео
Assertions with Shouldly
Переглядів 13021 день тому
Hi there! Since Fluent Assertions library changed their license, let's see an alternative! Shouldly Documentation: docs.shouldly.org #csharp #dotnet #shouldly
What's Wrong with Microservices?
Переглядів 8928 днів тому
Hi there! Today we are going to talk about microservices, the bad reputation sometimes get and why that is. #csharp #dotnet #microservices
WireMock With Testcontainers
Переглядів 81Місяць тому
Hi there! Today we are going to see how we can use WireMock with Testcontainers for our Integration Tests. #csharp #dotnet #wiremock
Making Local Development with Azure Service Bus Effortless
Переглядів 1572 місяці тому
Hi there! Today we are going to see how local development, when using azure service bus, can became easy! #csharp #dotnet
Handling Concurrency Conflicts with Entity Framework
Переглядів 2442 місяці тому
Hi there! Today we are going to see how we can handle concurrency conflicts with Entity Framework, using the optimistic concurrency approach! Chapters: 00:00 : The Problem 03:45 : What is Versioning 05:17 : Versioning (SQL Server) 06:25 : Versioning (Generic Solution) #csharp #dotnet #entityframework
Hangfire Dashboard
Переглядів 4343 місяці тому
Hi there! Today we are going to see how we can add a useful Hangfire Dashboard. #csharp #dotnet #hangfire
Domain Events with Dapper
Переглядів 2265 місяців тому
Hi there! Today we are going to see how we can publish Domain Events when we are using Dapper as out ORM. #csharp #dotnet
TimeSpan Explained
Переглядів 1236 місяців тому
Hi there! Probably you are already familiar with TimeSpans in .net, but in this short video we take a closer look at them.
How to Mock Identity in Integration Tests
Переглядів 2527 місяців тому
Hi there! A common problem when it comes to integration tests is how to bypass identity. There are a few alternatives, some work, others not. Today we are going to see how to mock Identity, so that it will no longer be a problem! #csharp #dotnet
MediatR in depth (Part 4: Streaming)
Переглядів 1728 місяців тому
Hi there! In this new video series, we will explore all of MediatR features. In this video we will see MediatR's streaming capabilities. Full Playlist: ua-cam.com/play/PLtgaC3-iBpdjckV1yLezLNeJwRpOnY5XT.html Introduction to IAsyncEnumerable: ua-cam.com/video/fYwewOtFzA0/v-deo.html #csharp #dotnet #mediator
MediatR in depth (Part 3: Notifications)
Переглядів 1628 місяців тому
Hi there! In this new video series, we will explore all of MediatR features. In this video we will see MediatR's Notifications. Full Playlist: ua-cam.com/play/PLtgaC3-iBpdjckV1yLezLNeJwRpOnY5XT.html #csharp #dotnet #mediator
MediatR in depth (Part 2: Behaviors)
Переглядів 1619 місяців тому
Hi there! In this new video series, we will explore all of MediatR features. In this video we will see MediatR's Behaviors. What are Middlewares and why their order matters: ua-cam.com/video/QiKHHFCF0xk/v-deo.html Full Playlist: ua-cam.com/play/PLtgaC3-iBpdjckV1yLezLNeJwRpOnY5XT.html #csharp #dotnet #mediator
MediatR in depth (Part 1: Mediator)
Переглядів 26810 місяців тому
Hi there! In this new video series, we will explore all of MediatR features. In this video we will see MediatR as a mediator implementation. Full Playlist: ua-cam.com/play/PLtgaC3-iBpdjckV1yLezLNeJwRpOnY5XT.html #csharp #dotnet #mediator
How to combine Redis with MediatR
Переглядів 31111 місяців тому
Hi there! Today we are going to see how we can combine Redis with MediatR' s pipelines, so we can implement caching in every request that we want effortlessly. Introduction to Redis: ua-cam.com/video/N8kdnMFjliI/v-deo.html Chapters: 00:00 : Intro 01:23 : CacheAttribute 02:41 : CacheService 06:24 : CacheBehavior 14:05 : Debugging #csharp #dotnet #redis #mediator
The OwningComponentBase Class of Blazor Server
Переглядів 178Рік тому
The OwningComponentBase Class of Blazor Server
How to Implement the Result Pattern with the ErrorOr Library
Переглядів 2,5 тис.Рік тому
How to Implement the Result Pattern with the ErrorOr Library
How to create a Mediator from scratch (Part 2)
Переглядів 172Рік тому
How to create a Mediator from scratch (Part 2)
How to create a Mediator from scratch (Part 1)
Переглядів 305Рік тому
How to create a Mediator from scratch (Part 1)
How to use Output Cache with Authentication
Переглядів 1,2 тис.Рік тому
How to use Output Cache with Authentication
Automating Service Registration with Reflection
Переглядів 476Рік тому
Automating Service Registration with Reflection
Dependency Injection with Scrutor: Scanning and Registering
Переглядів 1,4 тис.Рік тому
Dependency Injection with Scrutor: Scanning and Registering
Why sometimes async and await are bad for your app
Переглядів 218Рік тому
Why sometimes async and await are bad for your app
Should you use Result as your return type?
Переглядів 316Рік тому
Should you use Result as your return type?
Add vs AddAsync - Which one should you use?
Переглядів 603Рік тому
Add vs AddAsync - Which one should you use?
How to create Custom Validation Attributes
Переглядів 318Рік тому
How to create Custom Validation Attributes
I Liked :3
Hello, Isn't simpler actually to just go with lets say in your example with ACID transactions?
Hi! That would be the pessimist approach, where you would have to lock the row (there are different type of locks) which could impact the performance of the application. As a general rule, if you wait that type of collisions to appear rarely, it's preferred to use the optimistic approach. But it in the end of the day it's a trade-off and comes down to what you need for your app.
Interesting Video! 👍
Thanks a lot George!
Could you please provide the code... Thanks in advance
Hi! Since i don't have yet a solution for sharing the source code, you can download it from google drive: drive.google.com/file/d/16QPxheaIt57G2MKicC3KuwBv1wH_AalW/view
i was wondering how to do that with a void method. Didn't know you can do an ErrorOr<Success> Thanks for the tutorial
Glad I could help!
Hi, after we implement that approach (in video), can we integrate with polly for retry part instead of returning an exception directly or any suggestions ?
Hi! You can always catch the exception (in a global exception handler for example) and return the appropriate message. Just retrying will not change anything since the row in the database will have a different version, which is also the point. You can retry to update some of the values, IF that's something you want. More details about that here: learn.microsoft.com/en-us/ef/core/saving/concurrency?tabs=data-annotations
@@spyroskatsios thank you for the explanation.
Very useful video, with real practical meaning in real apps. I think first you should start with adding simple property and if instead of using change tracker and slowly make it more complex. Most of time we need it on 1-2 endpoints. What about handling it with transactions ? I had one app where i had concurrency error but debugging was impossible, how to debug it ? Some event was changing something and data fetched by user was already "dirty"
Hi! Thank you for your kind words! I didn't get exactly the problem, but maybe you want to take a look at transaction isolation levels?
And now, all the calls to that API are unauthenticated... The cache management it's before authentication, you have to be more carefull of what you do, it something cannot be done by default, ask yourself why... EDIT: I just had to add the cache after adding the authentication instead of adding it at the beginning 🤣🤣
What do you mean ' all the calls to that API are unauthenticated' ??
@@spyroskatsios Just the first call to the API are Authenticated, because the cache it's resolved before the authentication, so, meanwhile the call it's cached, the authentication it's bypassed
@@Tefery It's not resolved before the authentication. The Authentication Middleware is before the cache one. Maybe you are looking at the order of the Attributes? If yes, the order of middleware components in the request pipeline is the one that matters.
@@spyroskatsios True, I just had to add the cache after adding the authentication instead of adding it at the beginning 🤣🤣
excellent video, i have a unit of work that works like your people service. i was gana make some stupid solution work but transient seems the way to go, thank you!
Glad i could help 😊
Give git for access the code
Hi! Since i don't have yet a solution for sharing the source code, you can download it from google drive: drive.google.com/file/d/1hZLSkDMGZw5DGfyYlwauR3Ysi9Qqbp1f/view?usp=sharing
Thanc@@spyroskatsios
How to user ErrorOr with void methods? Let's say I would like to validate errors on caller side but don't wanna return anything as result from the method.
I don't get exactly what you want to achieve, but the erroror as every result pattern library have the usage of returning some kind of union (one or the other), so if you are using a method that returns void, you are not using the library
So in void method we can't have error or what?
You can use ErrorOr<Success> so you can return Success if not failed and the error otherwise.
Thank you Spiro, excellent video on this important pattern... great supplement to the docs of the library
Thank you very much!
Good video.
Thank you! 😊
Best video about ElasticSearch i have been seen, thanks a lot!
Wow, thanks! 😀
That's a interesting way to handle it. What if we have a worker that works async? I'm aswering because in that type of projects we don't have a MediatR with Pipelines Behaviors.
Hi! The middleware serves the purpose of having everything in a single transaction. So, I guess you can have a transaction whenever you need and publish the events inside of it.
great video! thx for the example!
Glad it was helpful!
Excellent Lesson.
Thanks a lot! 😊
great video! i would like to see an implementation of publishing the domain events without mediatr
Thank you! Is that what you're looking for? ua-cam.com/video/DUSPIBRjtog/v-deo.htmlsi=l5uD9BeDuyYc1v_4
@@spyroskatsios Yes! thank you very much
Hey, great video. One thing that I am still wondering with DBContextFactory and Services such as the PeopleService in the video is: how would you coordinate chaging/saving/getting of data across two or more services. Say for example a UserService calls a AddressService?
Hi! I would go with a different approach. Instead of using the DBContextFactory I would use the DbContext as in any other app, but i would create a different scope each time I wanted to call a service. Also, if I was going to use Mediatr I would create my own Dispatcher which would be just a wrapper of creating a scope and calling the IMediatr.
u write some code that u say is good - but u give no proof or explanation. Would be helpful if you could point out the MS Learn best practise for DBContext and Blazor and tie that in with your coding.
@@Lazzerman42 I explain what's the issue with scoped services in Blazor in a dedicated video which I have in the description and I mention in my video. Having said that, you could argue about the quality of my video and how well I communicate how Blazor behaves, since those videos were some of my first ones. Maybe at some time in the future I will remake them and have some diagrams as well.
@@spyroskatsios Thanks! Found this, ua-cam.com/video/CalH0TJrhp8/v-deo.html Together with your video it now seems clear. You don't want a long lived DB Context that is used by many different functions, since the context will "collect error, tracking and concurrency state" over time
Thanks, man. Great stuff!
Thank you very much! :)
Thank you! Straight to the point and informative.
Thank you! 😊
Thanks man
You're welcome! 😊
If anyone come across this attempting to use authenticated user output cache strategy you might be interested in CacheVaryByRules.VaryByValues dictionary that may be added-to/manipulated during IOutputCachePolicy.CacheRequestAsync
Great , What do you think about making a coruse about real project using all these concepts ? I would totally buy it your content is the best
Thank you so much for your kind words! Unfortunately, my audience is at the time very small, so i can't dedicate the time for a full course. Having said that, I'm preparing a project with concepts (among some of those I talk on my videos) like DDD, microservices, token auth (including refresh tokens) and others! Althought I can't go step by step on videos, I'll let you all know when I upload it on github (hopefully before autumn) and probably I'll make an overview video about it.
that's simple and clean thank you
You're very welcome!
can i keep rules in database ?
Hi! I suppose you could, but in what form are you going to store them?
@@spyroskatsios now i try to study Drools. but dont know how to install and integrate with eclipse (java). so i not sure c# also have rule engine that can keep rules in configuration file, xml or database or not?
Hi, what language you are speaking?
Some high quality stuff here, thanks!
Thanks! Glad you liked it!
so don't use the Unit.Value return type at all now?
You can still use it, but since it's a 'contract' for not returning anything, this update removes unnecessary code!
@@spyroskatsios OK cool thanks
Very hard to see the code, please consider to increase the font size for further videos
Newer videos have bigger font size!
Keep it up 🚀❤
Thanks 😊
Thanks a million. Exactly what I was looking for with no fluff and straight to the point. Following the channel for sure!
Thanks a lot man!!!
It's a great video. One of its kind on this subject matter
Thank you very much! 😊
oh shiet, accidentally find vid in your channel, althogth have few sub, but very high quanlity, +1 sub bro 🤝
Really appreciate it man!
Cache invalidation?
If you are talking about manually invalidating it, didn't fit in the logic of that video!
@@spyroskatsios yeah that’s the one. Cool, looking forward to your next video :)
Very interesting topic. Thanks for making it.
Thank you for your consistent kind words! 😊
Very nice video, any chance you could add repo ?
Of course! github.com/spyroskatsios/UA-cam-SearchFilters
@@spyroskatsios you are a super star :)
Good solution, however, I feel that the DiscountRule enum will break the open-closed principle because you will need to modify the enum every time you add a Rule. I would still vote for the order, even if you can assign IDs with gaps, such as ID=100, ID=200. This could give you the freedom to add up to 99 possible rules in between. However, that option isn't perfect either, as it would force you to anticipate what other rules might be added. Nonetheless, it's a good topic and solution. Thanks.
I like your solution! Thanks for your kind words!
thanks for the ErrorOr tutorial
You are very welcome!
Nice video, thanks! Try to make the IDE fonts a bit bigger, code was blurry! Just a point, as I know, domain events must be handled in the same transactional scope, and rollback if fails! By the way, the event you are publishing looks more like a integration event than a domain event!
You are right! You want to have a mechanism of handling domain events fails. Wrap in a transaction the process of handling them, if you want the changes to be immediate, wrap in a transaction the process of saving them if you use the outbox pattern with eventual consistency, etc. I wanted to keep it simple and focus only in the publishing with Mediatr side of things!
nice video.
Thank you!
oh nice thank you !
You're welcome! :)
Simple as it gets! Thanks for this video! Waiting for the next episode!
Thank you very much!
I want to copy the code. Do you have github link for this ?
I uploaded it: github.com/spyroskatsios/UA-cam-RulesEngineDemo
thanks @@spyroskatsios
Good video.
Thanks a lot!
The feeling that mechanical keyboards can create a new language when you start typing on them 😅 Nice video
If I don't hear that clicky sound, I don't feel like I'm coding 😂 Thank you!
Why we added Hero and cilvilan dbset too in dbcontext ?
Because we want to treat them as different entities in the app. The point is that we can have different ones, but still save them on the same table, if we choose to.
Great video .. lets say i want to another class name Manager and the manager has a list<Person> employees for example .. how i can do that ? and how i can configuare it ?
You mean without Discriminators? Like two entities that one has a list of the others?
@@spyroskatsios no with Discriminators the same like you how u created Hero that extends person . i want to make manager that extends Person and contains a list<Person> employees for example
@@mohamedal-qadeery6530 doesn't it work with the default way, by adding the List to the Manager?
@spyroskatsios No it didn't work or maybe i did something wrong idk
@@mohamedal-qadeery6530 Add the property to the Manager and also configure it with HasMany inside the ManagerConfiguration.