Coding Tutorials

Old schoolers!  Keep up to date with new fangled ways of coding with these handy tutorials.

Hello World

This concise “Hello World” C# tutorial covers the basics including types and variables, classes and objects, LINQ and exception handling.

If you are interested in learning more about MVC, then check out this free Pluralsight video tutorial on MVC4. It’s hours of content by Scott Allen, who has the Ode to Code blog, and it’s very good.

Finally there’s this tutorial on WPF and XAML.  It looks as if WPF is hanging in there as a desktop app solution, whether it will replace WinForms for line of business apps remains to be seen.

Data Layer Class Generator

I can’t remember where I found it, but this SQL script will generate a Dapper compatible class file for the table you specify.

Also this script is handy to use in the business / mapping layer of you application:

SELECT SCHEMA_NAME(SCHEMA_ID) AS [Schema], 
SO.name AS [ObjectName],
REPLACE(p.name, '@', 'rec.') + ',' as prop,
SO.Type_Desc AS [ObjectType (UDF/SP)],
P.parameter_id AS [ParameterID],
P.name AS [ParameterName],
TYPE_NAME(P.user_type_id) AS [ParameterDataType],
P.max_length AS [ParameterMaxBytes],
P.is_output AS [IsOutPutParameter]
FROM sys.objects AS SO
INNER JOIN sys.parameters AS P 
ON SO.OBJECT_ID = P.OBJECT_ID
WHERE SO.OBJECT_ID IN ( SELECT OBJECT_ID 
FROM sys.objects
WHERE TYPE IN ('P','FN'))
AND SO.name = 'YourProcedureSave'
ORDER BY [Schema], SO.name, P.parameter_id