Your daily does of #DotNet videos. We cover a wide variety of topics like #AspNetCore, #Blazor, EntityFramework Core, software architecture and so much more. You'll also find here regular live coding sessions.
First off, well done! You nailed the issue but missed one PIVOTAL explanation. You used CreateDbContextAsync .... VITAL to understand this here and subtly different than CreateDbContext (sync method which is NOT thread safe). One should NEVER use the CreateDbContext sync method in concurrency - which you have not so well done but please explain this in your demo. :)
@guyonfellow2 күн бұрын
Good information but background music is distracting
@AmortizedLogN2 күн бұрын
Great video. However, won't using per-operation dbcontext or a transiant DBContext take away all the benefits of using EF Core? Such as lazy-loading, Change Tracking, First-Level Cache, Unit of Work... At that point EF Core just becomes an ORM. And since scoped DBContext doesn't work well with Server-side Blazor at all, it requires implementing something custom, with some kind of Context Locator that allows to use one DBContext per business operation/transaction.
@Lazzerman422 күн бұрын
if you set the Authorize attribute on the Home.razor it will redirect to login ? I can't see the problem? You may want some pages (like the login page) to be open and some some to require login
@tapesteer4 күн бұрын
You didn't provide a full explanation here. How do you register the pipeline behavior so that it is used by mediatr for example? If you use blazor and you have a dbContextFactory instead which is Scoped, will this pipeline still work considering that here you set the context instance to be transactional, but each handler in blazor will have it's own context then so doing it here is redundant unless you somehow pass the same context down the pipelines.
@luceniosm4 күн бұрын
Great, this solution solve my task. thanks
@Kanfutizer6 күн бұрын
Wow thanks was struggling with this for sometime. Couldn't find any easy to understand info about this flow by google. Thanks alot! This must make my development experience with Azure easier if I encounter any bugs in the future, just if.
@lucasgiunta88746 күн бұрын
I'm sorry but it's not micro front end module federation. You are just playing with reference between local project. But what about share in runtime component between app's writed in React/Angular or any other stack ? How are you exposing blazor component to another application like React ? The point of mcfe, it shouldn't be scope to the stack as it is just javascript file which is expose. How do you do that with Blazor ?
@anthonyanthamatten7 күн бұрын
Thanks for the concise instruction.
@user-hj6bb9my1f7 күн бұрын
Thanks for your video codewrinkles. Why are not uploading?
@beloaded37368 күн бұрын
Best lesson on this topic I have seen. Thanks sir
@magisteriumemporium14119 күн бұрын
Holy molly. Thank you Code wrinkles <3
@sighupcmd9 күн бұрын
I heard so many people struggling with Aggregate term, but all I see is just a classic GoF Facade done right.
@przemosz733713 күн бұрын
nice video, it will be nice if you add a information that you cna disable those errors using pragma statement that i sometimes very usfeull during only a development
@Pozetivchil15 күн бұрын
Thank you very much! Only after YOU i understand this theme! I love you! Thank you again!😘
@ghevisartor600515 күн бұрын
What if you have Policies and AuthorizationRequirements? Is the NotAuthorized of the Routes.razor invoked? I wish there was a <NotAuthenticated>. Even adding policyBuilder.RequireAuthenticatedUser() doesn't do much, it will still invoke the Requirement handler for example, in which you can't do much. If you specify a policy in the [Authorize(PolicyName)] it stop doing the automatic redirect. Any suggestion?
@ButuGruv15 күн бұрын
Is there a way to do this in the new .NET 8 Blazor Web App?
@DavidThielen15 күн бұрын
thank you - very helpful.
@gunnypaulgiles17 күн бұрын
I error out with exception unhandled highlighting var app = builder.Build(); I am new and trign to use VS 2022 nwet 7 server.
@semen08318 күн бұрын
Does logger scope matters when using plain text log files, not seq?
@samdorn283319 күн бұрын
This one is an integration test. Unit tests must not depend on external dependencies like a database
@AurelioCE8819 күн бұрын
Nice video, can i use minimal api in azuee function?
@tapesteer20 күн бұрын
Why do you make an API endpoint for thenlogout button? Why bot directly call the SignInManager in the component
@nelsonrivers854620 күн бұрын
Can you add a video that shows how to go about doing the "Refresh Token" part of this ? It would be much appreciated.
@DurgeshMarathe-zb3ge20 күн бұрын
Awesome tutorial, quick, simple, and yet covers everything. Brilliant Sir! this exactly that i want
@farzadjamshidicom21 күн бұрын
Thank you :)
@tapesteer22 күн бұрын
Something that I've been fighting to figure out for the past week and I hope you can spare some time to answer this. I got the antiforgery to work using the <Antiforgery/> element. This sets the cookie in the client header and then also in the request body. If however I want to not use a <form> element but instead to the logout using a method, I need to create an HttpClient instance, generate the antiforgery tokens using GetAndStoreTokens with the HttpContext and then create the request. The issue is that this request is bad because the HttpClient is missing the Header XSRF-TOKEN and the request is evaluated as invalid. How can we create valid http requests using antiforgery tokens using the programatic approach? I have not found any answer for this yet. The documentation from asp.net says to simply add the header with the name, but doing this still returns a "BadRequest" response.
@ghevisartor600523 күн бұрын
does it also update the @page component itself for the [Authorize] attribute? so you get the NotAuthorized view on the whole page component?
@farzadjamshidicom23 күн бұрын
Thank you so much.
@AjeetKumar-cy1ij23 күн бұрын
nice video
@zoranProCode24 күн бұрын
What is cancelation token, how it's used?
@farzadjamshidicom24 күн бұрын
Can we use create user profile handler in the register handler? Because one part of registration is creating user profile.
@danurarya082325 күн бұрын
Never know filter can be used to do many useful things, thanks for sharing your knowledge
@lightstream7825 күн бұрын
What if you want to have the best of both worlds, one single Windows service that hosts the long running background process as well as the minimal API to accept simple commands from a client to stop or pause the process for example? Can it be one in one single windows service instead of two?
@omahb25 күн бұрын
Wonderfull, Thank you :)
@yassermian991326 күн бұрын
I made an app in blazor server. If i display an invoice # 1 with detail rows and switch to invoice #2. then i if i go to DB back end and change Qty from 1 to 2 of Invoice #1 using update query. Now if i retrieve invoice #1 again in UI it still shows me old Qty and not Qty=2. Ever since I am using DBContextFactory this problem is gone.
@rvscootin345727 күн бұрын
Thanks!
@OlehYevseienko28 күн бұрын
Coudn't we use JSON Patch instead?
@maniraj192029 күн бұрын
Technically sound! Thank you!
@letsplay112229 күн бұрын
Amazing. Thanks you probably saved me a couple hours lmao
@yassermian991329 күн бұрын
Is EF Core going to work with DbContext Factory without any modifications?
@sashawild1Ай бұрын
Thank you for the video! What I still could not understand is if there is a way to adopt the clean architecture together with EfCore's IDbContextFactory approach? In my projects I widely use GraphQL and HotChocolate library and for the last one using IDbContextFactory seems to be the preferable way of work with DbContext. So are there any examples of code or at lease ideas described of how to deal with Repositories and UnitOfWork abstraction in a Clean architecture project when IDbContextFactory is involved?
@dominikkownacki8235Ай бұрын
While watching your video, I could add DI to my wpf app and it worked! Great job
@alexwerf6084Ай бұрын
Magnificent! I`ve spent several hours trying to do it, and so i can!
@ijeanpierrebpАй бұрын
a master class! ❤
@vijai851Ай бұрын
I was watching 3 or more videos before I hit this one. I didn't understand the pattern using previous videos & this one really helped me to pick up the topic. Thank you!
@andreasvanbergen9696Ай бұрын
Great video! Thank you for clarifying this topic and telling the true story!
@farzadjamshidicomАй бұрын
Thank you for this video. My question is if we should update basic info from user profile, why we do not update comment text in post aggregate?
@anjanigenteАй бұрын
Thanks for info
@maksmaryanchuk710Ай бұрын
Hi @Codewrinkles ! Great video and explanation! Thanks, but I have a case where I use a service that connects to IHostedService via DI. This worm uses my database, and when I made a memory snapshot, I saw a bunch of MyDbContext objects (because it is of Transtient type). What is the best way to do in this case?
Пікірлер
First off, well done! You nailed the issue but missed one PIVOTAL explanation. You used CreateDbContextAsync .... VITAL to understand this here and subtly different than CreateDbContext (sync method which is NOT thread safe). One should NEVER use the CreateDbContext sync method in concurrency - which you have not so well done but please explain this in your demo. :)
Good information but background music is distracting
Great video. However, won't using per-operation dbcontext or a transiant DBContext take away all the benefits of using EF Core? Such as lazy-loading, Change Tracking, First-Level Cache, Unit of Work... At that point EF Core just becomes an ORM. And since scoped DBContext doesn't work well with Server-side Blazor at all, it requires implementing something custom, with some kind of Context Locator that allows to use one DBContext per business operation/transaction.
if you set the Authorize attribute on the Home.razor it will redirect to login ? I can't see the problem? You may want some pages (like the login page) to be open and some some to require login
You didn't provide a full explanation here. How do you register the pipeline behavior so that it is used by mediatr for example? If you use blazor and you have a dbContextFactory instead which is Scoped, will this pipeline still work considering that here you set the context instance to be transactional, but each handler in blazor will have it's own context then so doing it here is redundant unless you somehow pass the same context down the pipelines.
Great, this solution solve my task. thanks
Wow thanks was struggling with this for sometime. Couldn't find any easy to understand info about this flow by google. Thanks alot! This must make my development experience with Azure easier if I encounter any bugs in the future, just if.
I'm sorry but it's not micro front end module federation. You are just playing with reference between local project. But what about share in runtime component between app's writed in React/Angular or any other stack ? How are you exposing blazor component to another application like React ? The point of mcfe, it shouldn't be scope to the stack as it is just javascript file which is expose. How do you do that with Blazor ?
Thanks for the concise instruction.
Thanks for your video codewrinkles. Why are not uploading?
Best lesson on this topic I have seen. Thanks sir
Holy molly. Thank you Code wrinkles <3
I heard so many people struggling with Aggregate term, but all I see is just a classic GoF Facade done right.
nice video, it will be nice if you add a information that you cna disable those errors using pragma statement that i sometimes very usfeull during only a development
Thank you very much! Only after YOU i understand this theme! I love you! Thank you again!😘
What if you have Policies and AuthorizationRequirements? Is the NotAuthorized of the Routes.razor invoked? I wish there was a <NotAuthenticated>. Even adding policyBuilder.RequireAuthenticatedUser() doesn't do much, it will still invoke the Requirement handler for example, in which you can't do much. If you specify a policy in the [Authorize(PolicyName)] it stop doing the automatic redirect. Any suggestion?
Is there a way to do this in the new .NET 8 Blazor Web App?
thank you - very helpful.
I error out with exception unhandled highlighting var app = builder.Build(); I am new and trign to use VS 2022 nwet 7 server.
Does logger scope matters when using plain text log files, not seq?
This one is an integration test. Unit tests must not depend on external dependencies like a database
Nice video, can i use minimal api in azuee function?
Why do you make an API endpoint for thenlogout button? Why bot directly call the SignInManager in the component
Can you add a video that shows how to go about doing the "Refresh Token" part of this ? It would be much appreciated.
Awesome tutorial, quick, simple, and yet covers everything. Brilliant Sir! this exactly that i want
Thank you :)
Something that I've been fighting to figure out for the past week and I hope you can spare some time to answer this. I got the antiforgery to work using the <Antiforgery/> element. This sets the cookie in the client header and then also in the request body. If however I want to not use a <form> element but instead to the logout using a method, I need to create an HttpClient instance, generate the antiforgery tokens using GetAndStoreTokens with the HttpContext and then create the request. The issue is that this request is bad because the HttpClient is missing the Header XSRF-TOKEN and the request is evaluated as invalid. How can we create valid http requests using antiforgery tokens using the programatic approach? I have not found any answer for this yet. The documentation from asp.net says to simply add the header with the name, but doing this still returns a "BadRequest" response.
does it also update the @page component itself for the [Authorize] attribute? so you get the NotAuthorized view on the whole page component?
Thank you so much.
nice video
What is cancelation token, how it's used?
Can we use create user profile handler in the register handler? Because one part of registration is creating user profile.
Never know filter can be used to do many useful things, thanks for sharing your knowledge
What if you want to have the best of both worlds, one single Windows service that hosts the long running background process as well as the minimal API to accept simple commands from a client to stop or pause the process for example? Can it be one in one single windows service instead of two?
Wonderfull, Thank you :)
I made an app in blazor server. If i display an invoice # 1 with detail rows and switch to invoice #2. then i if i go to DB back end and change Qty from 1 to 2 of Invoice #1 using update query. Now if i retrieve invoice #1 again in UI it still shows me old Qty and not Qty=2. Ever since I am using DBContextFactory this problem is gone.
Thanks!
Coudn't we use JSON Patch instead?
Technically sound! Thank you!
Amazing. Thanks you probably saved me a couple hours lmao
Is EF Core going to work with DbContext Factory without any modifications?
Thank you for the video! What I still could not understand is if there is a way to adopt the clean architecture together with EfCore's IDbContextFactory approach? In my projects I widely use GraphQL and HotChocolate library and for the last one using IDbContextFactory seems to be the preferable way of work with DbContext. So are there any examples of code or at lease ideas described of how to deal with Repositories and UnitOfWork abstraction in a Clean architecture project when IDbContextFactory is involved?
While watching your video, I could add DI to my wpf app and it worked! Great job
Magnificent! I`ve spent several hours trying to do it, and so i can!
a master class! ❤
I was watching 3 or more videos before I hit this one. I didn't understand the pattern using previous videos & this one really helped me to pick up the topic. Thank you!
Great video! Thank you for clarifying this topic and telling the true story!
Thank you for this video. My question is if we should update basic info from user profile, why we do not update comment text in post aggregate?
Thanks for info
Hi @Codewrinkles ! Great video and explanation! Thanks, but I have a case where I use a service that connects to IHostedService via DI. This worm uses my database, and when I made a memory snapshot, I saw a bunch of MyDbContext objects (because it is of Transtient type). What is the best way to do in this case?