]]>http://blog.tiagosalgado.com/2014/09/02/chrome-dev-tools-dark-theme/feed/0http://blog.tiagosalgado.com/2014/09/02/chrome-dev-tools-dark-theme/Add Validation rules with FluentValidationhttp://feedproxy.google.com/~r/oito/~3/E9vDBAbm3vU/
http://blog.tiagosalgado.com/2014/08/31/add-validation-rules-with-fluentvalidation/#respondSun, 31 Aug 2014 00:19:19 +0000http://blog.tiagosalgado.com/?p=1418… →]]>One scenario we have in almost all applications where requires user inputs, are validation rules. We have lot of different ways to implement validation (both server and client sides), and one of these ways is using a library called FluentValidation, where it uses lambda expressions to build all validation rules.

To integrate it, we can get the package from Nuget and add it to our project:

Having our class created, we can now define the rules to validate a Person entity in the validator class constructor. For this example, I’ll add two rules, one to validate if the first name is not empty and other to make sure we have a age greater than 18.

FluentValidation already includes some built-in validations, so for our first validation we can use the NotEmpty() method. For the second validation, we’ve created a new method who verifies the Age property value and makes sure is greater than 18. If not, it will throw an error.
In this case, the validator will go through all rules and will send the result back with any errors, but we can decide to stop on the first failure.

I’m not defining the FirstName and i’ve set the age as 17 to force both rules to fail, so the output will be both error messages:

This is just a example of how we can add FluentValidation to a project, but much more advanced validations can be done, so I recommend you to read the documentation and follow the examples available in the project page.

]]>http://blog.tiagosalgado.com/2014/08/31/add-validation-rules-with-fluentvalidation/feed/0http://blog.tiagosalgado.com/2014/08/31/add-validation-rules-with-fluentvalidation/Using Visual Studio 2013 with TFS and Git repositories on same projecthttp://feedproxy.google.com/~r/oito/~3/U0x-EEIUHuE/
http://blog.tiagosalgado.com/2014/08/12/using-visual-studio-2013-with-tfs-and-git-repositories-on-same-project/#respondTue, 12 Aug 2014 15:17:31 +0000http://blog.tiagosalgado.com/?p=1404… →]]>With Visual Studio 2013 is a nightmare to keep a git repository but having TFS as a source control plugin activated when we load the solution. Every time we open the solution, by default Visual Studio will select the Git provider and ignore completely TFS (oh, irony…)

To solve that, I had to move out the .git folder to an external folder and point the git dir to the actual source code folder.

[sourcecode gutter=”false” language=”plain”]
C:\Code (where I have all projects source code)
— C:\Code\ProjectOne\.git (this is a file, not a folder anymore)
— C:\Code\ProjectTwo\.git (this is a file, not a folder anymore)
[/sourcecode]

So, this .git file has to be generated as:

[shell]
$ echo "gitdir: /git/ProjectOne/.git" > .git
[/shell]

After doing this, you can open Visual Studio and TFS will be selected by default. You still be able to run a “git status” or any git command as you always did before.

]]>http://blog.tiagosalgado.com/2014/08/12/using-visual-studio-2013-with-tfs-and-git-repositories-on-same-project/feed/0http://blog.tiagosalgado.com/2014/08/12/using-visual-studio-2013-with-tfs-and-git-repositories-on-same-project/dotnetConf – 25th and 26th of June 2014http://feedproxy.google.com/~r/oito/~3/45e9Dm6IkhE/
http://blog.tiagosalgado.com/2014/06/21/dotnetconf-25th-and-26th-of-june-2014/#respondSat, 21 Jun 2014 01:54:16 +0000http://blog.tiagosalgado.com/?p=1402Channel9 is hosting on the 25th and 26th of June the dotnetConf.

dotnetConf is a free, online conference for helping developers create desktop, mobile, web, and cloud-based applications using the .NET Framework.

There are great sessions planned so is totally worth it to watch. Go to dotnetConf and register, it takes just a few seconds.

Its available the 9th issue of DNC Magazine for download. Lot of nice articles are included such as “ASP.NET MVC 5 – Authentication Filters”, “Software is not a building”, “The new Hub Control in Windows 8.1” and much more.

]]>http://blog.tiagosalgado.com/2013/11/01/9th-issue-of-dnc-magazine/feed/0http://blog.tiagosalgado.com/2013/11/01/9th-issue-of-dnc-magazine/Alert users when they have lost internet connectivity with Offline.jshttp://feedproxy.google.com/~r/oito/~3/SFX9t8EGkIc/
http://blog.tiagosalgado.com/2013/11/01/alert-users-when-they-have-lost-internet-connectivity/#respondFri, 01 Nov 2013 18:00:31 +0000http://blog.tiagosalgado.com/?p=1378… →]]>To alert users when they’ve lost internet connectivity, we can use a really tiny library (only 3kb) called Offline.js.

So, what is Offline.js?

Offline.js is a library to automatically alert your users when they’ve lost internet connectivity, like Gmail.
It captures AJAX requests which were made while the connection was down, and remakes them when it’s back up, so your app reacts perfectly.

It is really straightforward to add implement this on our web applications.

1. Download Offline.js
2. Download a theme. For that, choose yours here.
3. Add the JS and CSS files to your pages.
4. Add a div to be used to display the notification (see full code for an example)