I started the 2nd day of the Microsoft Tech Days with a level 400 session.
Hugo Kornelis – T-SQL User-defined functions
Hugo showed us why T-SQL User defined functions can be catastrophic for our database performance by demonstration it with live examples (he had 7 slides in his presentation deck!). With the statement:
SET STATISTICS IO ON;
You can see how many read/writes each table receives and how the SQL optimizer does clever things behind the scenes. Example: removing joined tables from the execution when it isn’t part/effects of the result.
Facts that I remembered
- Query plan must be read from right to left (already knew that, but not everybody does).
- User-defined functions are a black box for the SQL optimizer. This can affect the actual query plan.
- Estimated query plan doesn’t show the actual reads/writes when UDF is involved
- Table valued user defined function returns a table are better for the optimizer (no scalar value), but doesn’t solve the duplicate code issue.
- Inline table valued user defined functions delivers statistics to the SQL optimizer. From a conceptional point of view this is actually a parameterized view (=macro). This delivers the performance you need, but can be hard to write. You need statements with CROSS APPLY.
- Not actually part of the topic: COALESCE(..expression..) is the better version of the ISNULL(..expression...) function.
Mads Kristensen – Creating Visual Studio Extensions
Bart de Smet session was cancelled, so this session was a last-minute addition to the conference. There were a few reasons to go here:
- There are not a lot of session about this topic (and thorough documentation is not available).
- Mads is the founding father of the Web Essentials extension, this session should be interesting.
He showed that almost everything is possible to extend. It’s only sometimes difficult to find out ‘how’. Creating extensions is mostly done by ‘Search Driven Development’. So use Google to find the info you need to complete your code. One of the reasons is the use of magic strings that are used for hooks in VS.
For extensions you need the Microsoft Visual Studio 2012 SDK. After you installed the VS2012 SDK you get extra extensibility project templates. Most of the times the ‘package’ template is best.
Testing and debugging
To test and debug your extension you just can press F5 then the Experimental Instance of Visual Studio will be launched as a testing container. This special version of VS has it’s own registry settings, so it doesn’t conflict with your normal version.
The VSIX package
A .vsix is just a zip file, so you can rename it and view the contents. Strangest thing is that VS doesn’t compress the package. So if you like to release a smaller package you best can:
- Rename to .ZIP
- Extract the files
- Rezip the files
- Rename to .VSIX
Note to self: try this stuff at home!
Alan Smith – Web Site Authentication with Social Indentity Providers
The session from Alan Smith was mainly about ACS: Azure Control Service. Microsoft is supporting multiple identity providers: Google, Yahoo, Facebook and LiveID accounts. All providers supports only the name identifier claim (which is unique and immutable). Only Google and Yahoo also deliver the name and email address as extra claims.
Steps within the ACS portal:
- Register the application (should match the realm)
- Define the rule and claims
- Add federation to the Asp.net project (think about setting the certificate validation to Off in the web.config of you development environment).
- Protect the resources with security settings in the web.config
- Security token = set of claims + encryption (optional) + signed
- Within ACS it’s possible to define extra Role Claims.
- Relying party should trust the identity provider
Blog of the Alan Smiths
Cross Platform Mobile Application Development met Xamarin and T4
Presentation was given by three developers of Avanade. There were no real demo’s, only some code on slides. This is a bit disappointing, it’s a developer conference!
Things that I remembered
- Targets on iOS, Android, WinRT (all phone and tablets). See screenshot example application.
- Mvvm Cross goal = 80% reusable .NET code for all platforms
- Makes use of Portable Class Library (1 assembly per platform)
- Mvvm Cross delivers IoC, plugins, converters and more..
- Uses T4 for generating code based on Views in XML
- Mvvm Cross – Views are platform specific
- Still need account for all stores (Windows Marketplace = 99 USD per year, Android Play Store = 25 USD per app, Apple iStore = 99 USD per year).
- Xamarin is a commercial product. Single developer is 299 USD. See pricing for more.
- Avanade created their on layer on top of Mvvm cross, called Tea Light.
- Visual Studio has no coding assistence for T4. Avanade developers recommended Tangible T4 Editor. This is also a commercial product.
Tip: for testing on mobile devices can be done in the cloud by using PerfectoMobile.com
Jeff Prosise – HTML 5: The Good, the bad, and everything in between
Jeff presentation was covering misc. HTML5 features with a lot of demo’s. He provided each HTML5 feature with a Grade (A to F) and explained us why with Pro’s and Con’s which was nice!
See the video, it says it all..