Stored Procedures with Entity Framework Core in .NET 6 🚀

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


Table of Contents:
00:00 Stored Procedures with Entity Framework Core in .NET 6 🚀
01:02 The Web API Project with a SQL Server DB
03:18 Call a simple Stored Procedure with no Parameters
04:54 Call a simple Stored Procedure with Parameters
08:34 Call a Stored Procedure with an Update and two Parameters
11:34 A Sidenote on Affected Rows

🙏MANY THANKS TO THESE LOVELY PEOPLE:
@jacoviza
Thomas McMeekin
Ameet Jayawant
JesperNielsen
Paul
@Alaffer
Alvin Majid
Slava Ukrayini
Piotr Franczak
Jan Trichter
Tom
H. Ali
Ashley Gahl
Daniel Viveros
Mehmet Ali Ege
Winther
harry j
@Alaffer
Sam Catlow
Jim
Brian Williams
Gonzo
Jonas
Ariel Sartor
Andy Benson
@stevelikespies
Raphael Lukas
James Goforth
@williamdevine
Doug Nelson
Arif Hasanov
@kohji1712
@dlb78dlb
Thomas Korsgaard
FastTrak
Jeff Sager
Dan Moyer
AlgoMarket
Mennskr
Simon
Michael Mel
Hermann Rösch
Jim McNeal
Kieron
@mgrainger231
Gerrit Esmeijer
Axel
Kareem Skinner
Joaquim
Alain Legrand
Per Rieland
@prodrigu75
Greg
Brendan Maunder
Stageoner
Andrew Campbell
pascalditzfeld
PovilasSimanskas
jenö
Marco Otilli
Mark
l33ter
alibux
Luke Vincent
mrcl
Alain Legrand
Thomas Werner
István Csibor
Grant Burdon
@gianluigiconti
Gerrit Esmeijer
Illia
Németh-Pók István
Michael Mel
Marko Zdilar
GerryB
@DADA_universe
Domen Hren
@heroesch
Carey
Peter De Tender
Baris Keskin
@Big_Bear_27390
Mathias
walter e watkins
Günther Dassel
Axel
Josh
Daniel Huber
Fredric Adell
Juan Carlos
Manolis
Pajani
P.
Jonas Granlund
Bobby
Kristina
@xamarin007

#DotNet #EfCore #PatrickGod
Рекомендации по теме
Комментарии
Автор

Always use the ExecuteSqlInterpolatedAsync and the FromSqlInterpolated instead of the older methods shown in this video. This will defend your API for SQL Injection attack.

codingbloke
Автор

I always use Scaffold-dbcontext rather than migrations as I find it a much more clean work flow. Is there a way to get the sprocs now?
I recall we used to be able to do this back in the day (was it ef or linqtosql?). It was great, it generated a method on the context with mapped parameters and return types 👌

PontusWittenmark
Автор

In particular, never pass a concatenated or interpolated string ($"") with non-validated user-provided values into FromSqlRaw or ExecuteSqlRaw. The FromSqlInterpolated and ExecuteSqlInterpolated methods allow using string interpolation syntax in a way that protects against SQL injection attacks.

codemonk
Автор

Thanks for sharing your time and knowledge with the community, as always an excellent video.

tigshinigami
Автор

One thing I'm stuck on, and isn't shown in this video is how to run a SELECT SP that returns a set of results that doesn't correspond exactly to a table. It's a complex stored procedure that returns a series of joins, etc.

ExecuteSqlRawAsync only returns the number of rows affected and I can't run [TableName].FromRawSql since there is no corresponding scaffolded class (I'm using DB first since the database is huge and already existing).

JarretteSchule
Автор

Hi Patrick, i hope you are fine & doing well,

is it safe to pass parameters as you passed to query? i hope there isn't any SQL Injection Issue?
please confirm about SQL Injections with these queries... if any then how to avoid ?

Thanks

zameer.vighio
Автор

What is the difference between creating an API to perform these operations or creating an SP to do the same?

cortes-d-impacto
Автор

Is there a way to call a stored procedure that returns compounded data (union of tables) without using third-party nuget package? TIA

noelfrancisco
Автор

Hi Patrick could you please record a session on CRUD operation with YugabyteDB in .Net Core 6

dilipgautam
Автор

thanks for sharing this, you are awesome...

francosaavedra
Автор

Thanks, Can you tell if Oracle Entity Framework also we can work with stored Procedures ?
and can you show one example of inner join in stored procedure ?

saritalad
Автор

Guessing you can't auto generate classes of SPs and Views like you could in framework entity 6?

Bigbacon
Автор

most stored procedures return info from multiple table sources. EF Core cannot use sp's with JOINS in them or passing multiple parameters, correct?

legionsman
Автор

You're getting that alert because to changed the code logic and you already have the app running with the old code complied.

TXPhoenix
Автор

Hi,
You can return objects with a relationship using a keyless entity.

yazanalkobari
Автор

Hello my friend, you have any example whit call stored procedure from project in clean arquitecture?

Автор

Hi Patrick! Great video - thanks a lot. But one very interesting topic is not explained in your video: How can I create a stored procdedure within the DbContext? This DbContext would be the best place to create a stored procedure if a new database will be set up (Code first migrations). Thanks and best greetings from Austria. Jürgen

bytechanneltv
Автор

Please make one video of order and order details using store procedure

kakdiyaamit
Автор

For all youtubers who post educational content pls avoid background music. It totally annoying

clashclan
Автор

Thanks you, this video is very good.
Can you create a video subject ' hangfire with .Net'.

devvn