This means that services written in Giraffe will have comparable performance to services written with ASP.NET Core MVC. Although F# is fully supported in ASP.NET Core MVC, Giraffe has a different technical philosphy which takes advantage of multiple F# features, such as higher-order functions, partial application of arguments, and F# Types.Īdditionally, Giraffe sits atop the Kestrel HTTP Server, which is the same underlying technology that ASP.NET Core uses. Giraffe allows you to write web API routes in a functional style. I encourage you to try each of them and see which you prefer.Ī complete application shown in this post is available on GitHub. Suave and Freya are two other great technologies that can be used on. It’s also worth noting that Giraffe is not the only technology you can use to build web APIs. In this post, I’ll walk through building a web service with F# and. I had mentioned that there were a number of things you could build with F# and. ", p.Name, p.Earlier this year, I wrote about an update to the roadmap for F# and. this attribute makes code analysis to skip this class / Defines all strongly typed methods for calling stored procedures. In modern web applications users usually get an activation email to activate their account and prove their email ownership. Suppose we write a stored procedure that creates a new user and then returns the newly generated record back so we can know user's ID right after it's been created (along with all other data). This parser takes advantage of this fact. Majority of NPoco/PetaPoco methods have several overloads, one of them accepting Sql type parameter. This means that it doesn't generate any new NPoco methods, but rather parameters for them. End resultĪfter you configure SQL database connection string (found early in T4 template in code line 37) parser generates static classes with matching static methods that return NPoco.Sql object instances that can be used with your C# directly when manipulating data. bit will be mapped to bool?, datetime to DateTime?, but nvarchar to string as it's a nullable (reference) type already. Parser can't know whether particular parameters can be nullable or not, therefore all generated C# code uses nullable typed parameters. If you'd like to add additional ones, simply add new ones to typeMapper dictionary.Īll SQL types map to nullable value or reference C# equivalent types to satisfy possible value nullability. I've included most commonly used SQL types. There's a subset of all available types that this parser understands and uses. What about types and their compatibility? T4 will pick up all matching stored procedures, read their information and generate C# calling code with correctly typed and named parameters.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |