1- ### Library Powered By
2-
3- This library is powered by [ Entity Framework Extensions] ( https://entityframework-extensions.net/?z=github&y=entityframeworkextras-plus )
4-
5- <a href =" https://entityframework-extensions.net/?z=github&y=entityframeworkextras " >
6- <kbd >
7- <img src =" https://zzzprojects.github.io/images/logo/entityframework-extensions-pub.jpg " alt =" Entity Framework Extensions " />
8- </kbd >
9- </a >
10-
11- ---
12-
131What's EntityFrameworkExtras?
142=====================
153
164EntityFrameworkExtras provides some useful additions to EntityFramework, such as executing Stored Procedures with User-Defined Table Types and Output Parameters.
175
18- ### Executing a Stored Procedure with a User Defined Table Type
19-
20- * Define a stored procedure class
21-
22- ~~~ csharp
23- [StoredProcedure (" storedproc_AddMemberWithAddresses" )]
24- public class AddMemberStoredWithAddressesProcedure
25- {
26- [StoredProcedureParameter (SqlDbType .NVarChar , ParameterName = " ForeName" )]
27- public string FirstName { get ; set ; }
28-
29- [StoredProcedureParameter (SqlDbType .NVarChar ,ParameterName = " SurName" )]
30- public string LastName { get ; set ; }
31-
32- [StoredProcedureParameter (SqlDbType .Int )]
33- public int Age { get ; set ; }
34-
35- [StoredProcedureParameter (SqlDbType .Udt )]
36- public List <Address > Addresses { get ; set ; }
37- }
38- ~~~
39-
6+ Read more on our [ Website] ( https://entityframework-extras.net/overview ) .
407
41- * A User Defined Table Type parameter is declared as a List<> (List< Address >). The UDT will also require some attributes:
8+ ## Downloads
429
43- ~~~ csharp
44- [UserDefinedTableType (" udt_Address" )]
45- public class Address
46- {
47- [UserDefinedTableTypeColumn (1 )]
48- public string Line1 { get ; set ; }
10+ ### EF Core
4911
50- [ UserDefinedTableTypeColumn ( 2 )]
51- public string Line2 { get ; set ; }
12+ [ ![ nuget ] ( https://img.shields.io/nuget/v/EntityFrameworkExtras.EFCore?logo=nuget&style=flat-square )] ( https://www.nuget.org/packages/EntityFrameworkExtras.EFCore )
13+ [ ![ nuget ] ( https://img.shields.io/nuget/dt/EntityFrameworkExtras.EFCore?logo=nuget&style=flat-square )] ( https://www.nuget.org/packages/EntityFrameworkExtras.EFCore )
5214
53- [UserDefinedTableTypeColumn (3 )]
54- public string Postcode { get ; set ; }
55- }
56- ~~~
15+ ```
16+ PM> NuGet\Install-Package EntityFrameworkExtras.EFCore
17+ ```
5718
58- * Execute the Stored Procedure with either a DbContext or an ObjectContext
19+ ```
20+ > dotnet add package EntityFrameworkExtras.EFCore
21+ ```
5922
60- ~~~ csharp
61- DbContext context = new DbContext (" ConnectionString" );
23+ ### EF6
6224
63- var proc = new AddMemberStoredWithAddressesProcedure ()
64- {
65- FirstName = " Michael" ,
66- LastName = " Bovis" ,
67- Age = 26 ,
68- Addresses = new List <Address >()
69- {
70- new Address () {Line1 = " 16" , Line2 = " The Lane" , Postcode = " MA24WE" }
71- }
72- };
25+ [ ![ nuget] ( https://img.shields.io/nuget/v/EntityFrameworkExtras.EF6?logo=nuget&style=flat-square )] ( https://www.nuget.org/packages/EntityFrameworkExtras.EF6 )
26+ [ ![ nuget] ( https://img.shields.io/nuget/dt/EntityFrameworkExtras.EF6?logo=nuget&style=flat-square )] ( https://www.nuget.org/packages/EntityFrameworkExtras.EF6 )
7327
74- context .Database .ExecuteStoredProcedure (proc );
75- ~~~
28+ ```
29+ PM> NuGet\Install-Package EntityFrameworkExtras.EF6
30+ ```
7631
32+ ```
33+ > dotnet add package EntityFrameworkExtras.EF6
34+ ```
7735
36+ ## Sponsors
7837
79- ### Executing a Stored Procedure with an Output parameter
38+ ZZZ Projects owns and maintains ** EntityFrameworkExtras ** as part of our [ mission ] ( https://zzzprojects.com/mission ) to add value to the .NET community
8039
81- * To add an Output parameter, you need to set the Direction parameter to ParameterDirection.Output.
40+ Through [ Entity Framework Extensions ] ( https://entityframework-extensions.net/?utm_source=zzzprojects&utm_medium=entityframeworkextras ) and [ Dapper Plus ] ( https://dapper-plus.net/?utm_source=zzzprojects&utm_medium=entityframeworkextras ) , we actively sponsor and help key open-source libraries grow.
8241
83- ~~~ csharp
84- [StoredProcedure (" storedProc_GetOldestAge" )]
85- public class GetOldestAgeStoredProcedure
86- {
87- [StoredProcedureParameter (SqlDbType .Int , Direction = ParameterDirection .Output )]
88- public int Age { get ; set ; }
89- }
90- ~~~
42+ [ ![ Entity Framework Extensions] ( https://raw.githubusercontent.com/zzzprojects/EntityFrameworkExtras/master/entity-framework-extensions-sponsor.png )] ( https://entityframework-extensions.net/bulk-insert?utm_source=zzzprojects&utm_medium=entityframeworkextras )
9143
92- * Execute the Stored Procedure, and the parameter will be set to the output parameter value
93-
94- ~~~ csharp
95- var proc = new GetOldestAgeStoredProcedure ();
96-
97- context .Database .ExecuteStoredProcedure (proc );
98-
99- int age = proc .Age ; // Is now the oldest age
100- ~~~
101-
102- ## Useful links
103-
104- - [ Website] ( https://entityframework-extras.net/overview )
105- - [ Download] ( https://entityframework-extras.net/download )
106- - [ NuGet Entity Framework Core] ( https://www.nuget.org/packages/EntityFrameworkExtras.EFCore/ )
107- - [ Nuget Entity Framework 6] ( https://www.nuget.org/packages/EntityFrameworkExtras.EF6/ )
108- - [ Nuget Entity Framework 5] ( https://www.nuget.org/packages/EntityFrameworkExtras.EF5/ )
109- - [ Nuget Entity Framework 4] ( https://www.nuget.org/packages/EntityFrameworkExtras/ )
110-
111- ## Contribute
112-
113- The best way to contribute is by ** spreading the word** about the library:
114-
115- - Blog it
116- - Comment it
117- - Star it
118- - Share it
119-
120- A ** HUGE THANKS** for your help.
44+ [ ![ Dapper Plus] ( https://raw.githubusercontent.com/zzzprojects/EntityFrameworkExtras/master/dapper-plus-sponsor.png )] ( https://dapper-plus.net/bulk-insert?utm_source=zzzprojects&utm_medium=entityframeworkextras )
12145
12246## More Projects
12347
@@ -135,3 +59,5 @@ A **HUGE THANKS** for your help.
13559- and much more!
13660
13761To view all our free and paid projects, visit our website [ ZZZ Projects] ( https://zzzprojects.com/ ) .
62+
63+ To view all our free and paid projects, visit our website [ ZZZ Projects] ( https://zzzprojects.com/ ) .
0 commit comments