<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DEMERHs8fCp7ImA9WhBXGUU.&quot;"><id>tag:blogger.com,1999:blog-7673837</id><updated>2013-04-03T11:53:25.574+01:00</updated><category term="Message Queue" /><category term="LINQ" /><category term=".Net 4.0" /><category term="iis 7" /><category term="jQuery" /><category term=".Net 3.0" /><category term="SQL Server 2008" /><category term="KnockoutJS" /><category term="Asp.Net" /><category term="TFS" /><category term="SQL Server" /><category term="MSMQ" /><category term="Parallel Programming" /><category term="Asp.Net MVC" /><category term="SQL Server 2012" /><category term="XML Serialization" /><category term="Refactoring" /><category term="Extreme Programming" /><category term="TSQL" /><category term="Testing" /><category term="Asp.Net 4.0" /><category term="C#" /><category term="Hexadecimal" /><category term="Receipts" /><category term="Json" /><category term="Web Development" /><category term="Flash" /><category term="TDD" /><category term="Asp.Net 2.0" /><category term="WCF" /><category term="HTML" /><category term="IE" /><category term="Storage" /><category term="JavaScript" /><category term="ORCAS" /><category term="SSIS" /><category term="SSDT" /><category term="VS.net" /><category term="Serialization" /><category term="ADO.Net" /><title>eXtreme Programming</title><subtitle type="html">XP for the programmer</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://xprog.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>104</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/eljWH" /><feedburner:info uri="blogspot/eljwh" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>blogspot/eljWH</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;AkMDQ3g4eyp7ImA9WhBQGEg.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-8331754076608007983</id><published>2013-03-21T09:34:00.001Z</published><updated>2013-03-21T09:34:32.633Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-21T09:34:32.633Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSDT" /><category scheme="http://www.blogger.com/atom/ns#" term="VS.net" /><title>Fixing SSDT unresolved reference to object error</title><content type="html">The SQL Server Data Tools (SSDT) for Visual Studio 2012 are a great set of tools for database development, but as any tool they have some undesirable "features".
&lt;br&gt;
One of those "features" is the "unresolved reference to object" error. &lt;br/&gt;
The "unresolved reference to object" in a stored procedure is a warning, but for the function it is an error. The error fails the build and consequently the the schema compare and update of the database. &lt;br /&gt;
The error normally is caused by a query that references an object on other database.&lt;br&gt;
&lt;br /&gt;
One example of the error is:&lt;br /&gt;
Error 190 SQL71561: Function: [dbo].[myFunction] has an unresolved reference to object [myDatabase].[dbo].[Product]
&lt;br /&gt;
In the example the function [myFunction] is using the table [Product] from the database [myDatabase], that isn't the same database being managed by the database project of [myFunction].
&lt;br /&gt;
&lt;br /&gt;
A possible solution is to add a database reference to the database that has the missing object.
&lt;br /&gt;
The reference needs a Data-tier Application (dacpac file) that can be easily generated on the solution with the database project that has the missing object. Press the right mouse button over the database project and selected Snapshot Project. The dacpac file is created on the Snapshots folder.&lt;br /&gt;
The file should then be copied to a common folder for re-usability.&lt;br /&gt;
&lt;br /&gt;
In the project with the error press the right mouse button over the References and selected Add Database Reference.&lt;br /&gt;
The Add Database Reference dialog appears:&lt;br /&gt;
1) Select the dacpac file&lt;br /&gt;
2) Select the database location. The most common option is "Different database, same server"&lt;br /&gt;
3) Confirm that the Database name field is as expected&lt;br /&gt;
4) Clear the "Database variable" field in the dialog. If this field has a value the queries must use this variable and not the database name.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;img border="0" src="http://4.bp.blogspot.com/-cUXKiTfTScU/UT9qeEkqU1I/AAAAAAAABEA/n3uLbzYIFm0/s1600/DatabaseReference.png" /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Look at the "Example usage" text and verify that it looks as expected. Click "OK" to add the reference and that should take care of the 'unresolved reference' errors.
&lt;br /&gt;
&lt;br /&gt;
The database reference resolves the schema comparison issue, but trying to build the project produced the following error:
&lt;br /&gt;
Error 408 SQL00208: Invalid object name 'db.schema.table'.
&lt;br /&gt;
&lt;br /&gt;
To fix this error, go to the project properties and uncheck "Enable extended Transact-SQL verification for common objects".
&lt;br /&gt;
&lt;br /&gt;
&lt;img border="0" src="http://4.bp.blogspot.com/-s6mLx3ZQpn8/USOyxPEI0PI/AAAAAAAABBA/b63pAfv5v_E/s1600/settings.png" /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/u0hOt3abN-U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/8331754076608007983/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=8331754076608007983&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8331754076608007983?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8331754076608007983?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/u0hOt3abN-U/fixing-ssdt-unresolved-reference-to.html" title="Fixing SSDT unresolved reference to object error" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-cUXKiTfTScU/UT9qeEkqU1I/AAAAAAAABEA/n3uLbzYIFm0/s72-c/DatabaseReference.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2013/03/fixing-ssdt-unresolved-reference-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cCSXY5cSp7ImA9WhBTGU4.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-3475195740297123519</id><published>2013-02-15T14:37:00.001Z</published><updated>2013-02-15T14:37:48.829Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-15T14:37:48.829Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Dropdown list autopostback not working when validators fire</title><content type="html">The Dropdown server control of the webforms can automatically post back by setting the autopostback property to true and setting the change event.&lt;br /&gt;
It works as expected, except when you have validators on the form with client-side validation active. The post back causes the validators to fire and prevent the autopostback if the form is invalid.&lt;br /&gt;
&lt;br /&gt;
If there is the need to post back even if the form is invalid, the Microsoft documentation states that the CausesValidation property must be set to false. 
&lt;br /&gt;
However the issue still persists and the client side onchange event must execute the code Page_BlockSubmit=false&lt;br /&gt;
Page_BlockSubmit controls whether the form should be submitted or not.
&lt;br /&gt;
Here is a full example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:xml"&gt;
&amp;lt;asp:dropdownlist autopostback="true" 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;causesvalidation="false"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id="myDropDown" 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onchange="Page_BlockSubmit = false;"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onselectedindexchanged="myDropDown_SelectedIndexChanged"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  runat="server"&amp;gt;  &lt;br /&gt;
&amp;lt;/asp:dropdownlist&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Note that to apply the best practices the client side event onchange should be set on the code behind.
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
myDropDown.Attributes.Add("onchange", "myDropDownOnchange();");
&lt;/pre&gt;
&lt;pre class="brush:javascript"&gt;
function myDropDownOnchange() {
    Page_BlockSubmit=false;
}
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/WBW9RVlsuhQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/3475195740297123519/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=3475195740297123519&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/3475195740297123519?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/3475195740297123519?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/WBW9RVlsuhQ/dropdown-list-autopostback-not-working.html" title="Dropdown list autopostback not working when validators fire" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2013/02/dropdown-list-autopostback-not-working.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YDSHo4eSp7ImA9WhBTE0w.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-4003892024768319883</id><published>2013-02-07T19:02:00.003Z</published><updated>2013-02-08T09:19:39.431Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-08T09:19:39.431Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="TSQL" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2012" /><title>Query Optimization and the SQL Server Cache</title><content type="html">&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Query optimization is a very important task to assure that the server resources are not heavily consumed by a bad performing query.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;One of the important tasks when optimizing a query&amp;nbsp; is to clean the SQL Server Cache so that the results are not influenced by the caching mechanism.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;The T-SQL commands, that clean the Sql Server cache, will cause severe performance problems in a production environment, so they are to be used for testing purposes on a development or staging environment only.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;They can be executed in a production server in special and controlled conditions. An example is to remove an individual plan of a query that has a bad performance because of a bad plan cache.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;This article explains the main concepts involved and then the possible options to Clean the Sql Server Cache.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Execution Plan&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The execution plan is the result of the query optimizer attempt to 
 calculate the most efficient way to process the request represented by the 
 SQL query statement.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Sql Server has to build an execution plan for each Transact-SQL (T-SQL) statement it has to execute.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The&amp;nbsp; execution plan defines how the T-SQL statement can be executed by Sql Server to produce the desired results.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The execution plan is built based on several considerations:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;1) The tables it needes to join&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;2) The Indexes to use&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;3) The sub-queries it has to execute&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;4) How aggregations of Group By are calculated&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;5) The estimated cost and load the operations place on the system&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;6) other even more complex considerations&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The execution plan is also known as query plan.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;As can be easily understandable, SQL has to put a lot of work to build a Execution Plan, so it caches the execution plan in memory to avoid having to do the same work over and over again.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Sql Server uses the Plan Cache to reuse plans. In this way, SQL Server can avoid the overhead of calculating the execution plan for each T-SQL statement and in this way speed up the execution of the queries.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Plan Cache&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The plan cache is used by Sql Server to store the Execution Plans of the queries it has run.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The plan cache allows Sql Server to reuse Execution Plans for subsequent requests. It stores plans and it's associated 
information. There are metrics about the number of times a query was 
executed and the resources it used for example.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The Plan cache can be flush totally in some situations, the principal are:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;1) Sql Server Service Restarts&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;2) Statistics of an object changing&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;3) Restores of a database&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;4) Executing T-SQL commands to clean it&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;5) Insufficient Memory on the server, causing memory pressure&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;6) Detaching a database&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;7) Some T-SQL Commands like for example RECONFIGURE, ALTER DATABASE ... MODIFY FILEGROUP or modifying a collation using ALTER DATABASE … COLLATE command&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&amp;nbsp;The Plan cache of a database can also be flushed totally in some situations, where the principal are:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;1) Some operations like for example DROP
DATABASE or ALTER
DATABASE … MODIFY NAME&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;2) If the database auto-closes &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;3) The database is set online or offline&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Recompilations&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Sql Server checks for correctness and for the optimality of a query plan before it executes it.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;If one of the checks fails, the statement is compiled again and new query plan 
is produced.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;These compilations are named as recompilations. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The  recompilations are necessary to:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;1)&amp;nbsp; Ensure statement correctness&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;2)&amp;nbsp; Obtain potentially better query execution plans as data changes &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The recompilations can also have the side effect that they can slow 
down executions considerably.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In this case it is necessary to 
reduce the number of recompilations.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Parameter sniffing&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Parameter sniffing is a complex topic, but according to Microsoft:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;i&gt;"Parameter sniffing" refers to a process whereby SQL Server's execution environment "sniffs" the current parameter values during compilation or recompilation, and passes it along to the query optimizer so that they can be used to generate potentially faster query execution plans. The word "current" refers to the parameter values present in the statement call that caused a compilation or a recompilation.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The query optimizer uses the parameters passed to the statements for 
performing estimates&amp;nbsp; when evaluating possible execution plan options. The final effect is that the plan is optimized for those specific parameter values.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;This feature allows more efficient stored procedure execution plans in most cases. There is however an assumption that the parameter values are "typical".&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The main problem with this approach is when a parameter is atypical. The asymmetry usually is in the distribution of the data values or how the value is distributed across where the data is a non-uniform distribution, this is called skewed data.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&amp;nbsp;One example of skewed data is when there is a table with two million records and a column of type BIT. That column has the value 0 for only 1000 records and all the others have the value 0.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The LIKE clause is also very prune to this issue.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Parameter sniffing affects the performance of a query since the execution plan that is generated by the query optimizer depends on parameter sniffing.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Parameter values are sniffed for:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;1) Stored Procedures&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;2) Queries executed using sp_executesql &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;3) Prepared queries&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The following statements help to control the parameter sniffing performance problems:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;1) WITH RECOMPILE - the stored procedure&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;2) Dummy local variables that are set equal to a parameter&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;3) OPTION(RECOMPILE) - This query hint is used to extended the behavior to 
queries (SELECT, INSERT, UPDATE, or DELETE). In this case,&amp;nbsp; both the 
parameter values and the current values of local variables are sniffed.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;4) OPTION(OPTIMIZE FOR ())&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The explanation of these options are out of the scope of this article, but you can search for a detailed explanation if you wish to learn more. &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Clean the buffers&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Sql Sever buffers the data before it is written to disk, this can cause dirty pages.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;To guarantee that all these dirty pages, for the current
 database, are be written to disk and buffers are clean use the CHECKPOINT statement.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;CHECKPOINT forces all dirty pages for the current
 database to be written to disk and cleans the buffers. After you do 
this, you can issue DBCC DROPCLEANBUFFERS command to remove all buffers 
from the buffer pool.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The CHECKPOINT is to guarantee that if you performed an operation or if you are in a collaborative environment that you are also testing you don't end up with dirty pages in the buffers.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server.&amp;nbsp; It serves to empty the data 
cache.  Any data loaded into the buffer cache due to the prior execution
 of a query is removed.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Example:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;CHECKPOINT&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;GO &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;DBCC DROPCLEANBUFFERS&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Clean the Plan Cache&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;There are several options to clean the plan cache. The next sections are going to explain the principal options, but don't forget to always Clean the Buffers first.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Clean the entire Plan Cache&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The more drastic method is to clean the &lt;/span&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;entire &lt;/span&gt;Sql Server plan cache, using the statement &lt;b&gt;FREEPROCCACHE&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;This will free the entire plan cache and causes the recompilation of subsequent ad-hoc 
SQL statements or Stored Procedures.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Usage:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;DBCC FREEPROCCACHE&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Clean a Database Plan Cache&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;A less drastic option, is to clear only the entire plan cache for a specific database and not the full Sql Server Plan Cache.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Usage:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;DECLARE @dbId INTEGER&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;SELECT @dbId&amp;nbsp; = dbid FROM master.dbo.sysdatabases WHERE name = ‘myDatabase’&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;DBCC FLUSHPROCINDB (@dbId)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Where myDatabase is database to clear the entire plan cache.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The &lt;/span&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;@dbId parameter is the &lt;/span&gt;&lt;/span&gt;database&lt;/span&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt; the &lt;/span&gt;number (&lt;/span&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;database ID&lt;/span&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;) &lt;/span&gt;&lt;/span&gt;to be affected by the &lt;/span&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;FLUSHPROCINDB&amp;nbsp; command&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Clean a Compiled Plan&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In some situations it is useful to clean only a specific compiled execution plan for an Stored Procedure or a Ad-Hoc query.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;One example is when some queries are executed in production for testing or to Extract, Transform, Load (ETL) data and should be removed form the Plan Cache so that they don't occupy cache space.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Usage: &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;SELECT [text], CachedPlans.size_in_bytes, CachedPlans.plan_handle, CachedPlans.objtype, CachedPlans.usecounts&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;FROM sys.dm_exec_cached_plans AS CachedPlans&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;CROSS APPLY sys.dm_exec_sql_text(plan_handle)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;WHERE CachedPlans.cacheobjtype = N'Compiled Plan'&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;This query returns all the compiled plans.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The column Text identifies the T-SQL statement executed (Stored Procedure: proc or Ad-Hoc Query: Adhoc for example) and&amp;nbsp; the plan_handle can be passed to FREEPROCCACHE to remove it:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;DBCC FREEPROCCACHE (plan_handle)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;Clean&amp;nbsp; Stored procedure or Trigger Plan cache&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The sp_recompile statement causes the recompilation of stored procedures and triggers the next time that they are run.It drops the existing plan from the procedure cache.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Usage:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;EXEC sp_recompile N'myObject'';&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Where myObject can be a stored procedure, trigger, table, or view in the current database.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;If is the name of a stored procedure or trigger, the stored procedure or trigger will be recompiled the next time that it is executed.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;If object is the name of a table or view, all the stored procedures or triggers that reference the table or view will be recompiled the next time that they are executed. &lt;/span&gt;
&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/eljqunRns2o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/4003892024768319883/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=4003892024768319883&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/4003892024768319883?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/4003892024768319883?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/eljqunRns2o/query-optimization-and-sql-server-cache.html" title="Query Optimization and the SQL Server Cache" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2013/02/query-optimization-and-sql-server-cache.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAAQnczfyp7ImA9WhJUFEk.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-7592296414729556118</id><published>2012-09-12T12:19:00.000+01:00</published><updated>2012-09-12T12:19:03.987+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-12T12:19:03.987+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TFS" /><title>Undoing a checkout that is from another user</title><content type="html">A common task in TFS isto to undo someone else pending change for several reasons.&lt;br /&gt;
The TFS client doesn't have this option in the GUI, so we have to go to the command line as an administrator of TFS and enter the command:&lt;br /&gt;
&lt;br /&gt;
tf undo /workspace:UserWorkspace;Username  $/Project/file.cs /s:http://yourtfsserver:8080/tfs&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
- UserWorkspace is the workspace of the user to undo pending changes&lt;br /&gt;
- Username  is the user name of the user we wanto to undo the checkout&lt;br /&gt;
- $/Project/file.cs is the TFS path to the file to undo the checkout&lt;br /&gt;
-  /s:http://yourtfsserver:8080/tfs is the connection to the TFS Server&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/ZhCqHec9O30" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/7592296414729556118/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=7592296414729556118&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7592296414729556118?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7592296414729556118?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/ZhCqHec9O30/undoing-checkout-that-is-from-another.html" title="Undoing a checkout that is from another user" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/09/undoing-checkout-that-is-from-another.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YBQHkyeCp7ImA9WhJVE04.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-7832160341541612584</id><published>2012-08-30T13:51:00.002+01:00</published><updated>2012-08-30T13:52:31.790+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-30T13:52:31.790+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VS.net" /><title>Visual Studio 2012: Change default SQL Server Instace</title><content type="html">Visual Studio 2012 Database Project / Sql Server data tools (SSD ) installs and uses a SQL Server Express version named LocalDB for it's operations by default.
&lt;br /&gt;&lt;br /&gt;
LocalDB is created specifically for developers and is a fast, lightweight SQL Server instance that requires minimal management or configuration.
&lt;br /&gt;&lt;br /&gt;
This scenario is great is you don't have a SQL Server instance to develop.
&lt;br /&gt;&lt;br /&gt;
When a object is open, like for example a store procedure, and you execute the code Visual Studio 2012 will connect to LocalDB and there is no option to connect to other database.
The solution is to change the default SQL Server Instance used by Visual Studio 2012:
&lt;br /&gt;&lt;br /&gt;
1) On the menu, choose Tools-&gt; Options -&gt; Database tools&lt;br /&gt;
2) On the data connections enter the SQL server Instance name that you want to use&lt;br /&gt;
3) Press OK&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
Close all the database project files you have open on Visual Studio and the configuration is done.

&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/zF0zrvGVh-I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/7832160341541612584/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=7832160341541612584&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7832160341541612584?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7832160341541612584?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/zF0zrvGVh-I/visual-studio-2012-change-default-sql.html" title="Visual Studio 2012: Change default SQL Server Instace" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/08/visual-studio-2012-change-default-sql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4AQH0zcSp7ImA9WhJVEk4.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-9142455511054973222</id><published>2012-08-29T12:14:00.001+01:00</published><updated>2012-08-29T12:15:41.389+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-29T12:15:41.389+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>List of an anonymous type</title><content type="html">Anonymous types allows us to easily encapsulate a set of 
read-only properties of single object without the need to define a type first.&lt;br /&gt;
The type name is generated by the compiler and each property type is inferred by the 
compiler.&lt;br /&gt;
&lt;br /&gt;
Anonymous types are useful when using LINQ for example.&lt;br /&gt;
&lt;br /&gt;
A List of an anonymous type is something that at the first thought seems rather impossible, but for everything there is always a solution:&lt;br /&gt;
&lt;br /&gt;
1) First define the anonymous type:&lt;br /&gt;
&lt;pre class="brush:csharp"&gt; var person = new { Id = 1, Name = "John Doe" };
&lt;/pre&gt;
2) Then create the list of the anonymous type&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;var people = (new[] { person }).ToList();&lt;/pre&gt;

4) Add more items to the list easly &lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
people.add(new { Id = 2, Name = "Peter Doe" });
&lt;/pre&gt;

&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;

&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/DWRU_63UI-U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/9142455511054973222/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=9142455511054973222&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/9142455511054973222?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/9142455511054973222?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/DWRU_63UI-U/list-of-anonymous-type.html" title="List of an anonymous type" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/08/list-of-anonymous-type.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQHQn06fSp7ImA9WhJWFUg.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-6522863399438320789</id><published>2012-08-21T08:40:00.001+01:00</published><updated>2012-08-21T13:32:13.315+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-21T13:32:13.315+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VS.net" /><title>Visual Studio 2012 does not support SSAS, SSIS or SSRS</title><content type="html">Visual Studio 2012 and SQL Server 2012 have been launched by Microsoft recently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having that into account I was expecting to have full integration between the two products, but I discovered the hard way that Visual Studio 2012 does not have any support for the Integration Services (SSIS), Analisys Services (SSAS) or even the Reporting Services&amp;nbsp; (SSRS) projects.&lt;br /&gt;
&lt;br /&gt;
The SQL Server 2012 data tools (SSDT) offer an integrated environment within Visual Studio 2010, but there is no support for Business Intelligence on Visual Studio 2012!&lt;br /&gt;
&lt;br /&gt;
The SQL Server 2008 had the same issue with Visual Studio 2010.&lt;br /&gt;
&lt;br /&gt;
So get ready to have Visual Studio 2012 and Visual Studio 2010 side by side on the same development machine.&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/kwTfGHn73kQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/6522863399438320789/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=6522863399438320789&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6522863399438320789?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6522863399438320789?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/kwTfGHn73kQ/visual-studio-2012-does-not-support.html" title="Visual Studio 2012 does not support SSAS, SSIS or SSRS" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/08/visual-studio-2012-does-not-support.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4FSHc5eSp7ImA9WhJWFEo.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-2249049526801544738</id><published>2012-08-20T15:14:00.001+01:00</published><updated>2012-08-20T15:28:39.921+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-20T15:28:39.921+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VS.net" /><title>Some solutions to repair the Visual Studio 2012 UI</title><content type="html">&lt;br /&gt;
&lt;br /&gt;
&lt;span id="goog_764667830"&gt;&lt;/span&gt;&lt;span id="goog_764667831"&gt;&lt;/span&gt;The new visual stuidio 2012 UI is not &lt;span class="st"&gt;&lt;i&gt;consensual&lt;/i&gt; &lt;/span&gt;... so here are some tips to repair the Visual Studio 2012 UI:&lt;br /&gt;
1) Prevent Visual Studio 2012 ALL CAPS Menus&lt;br /&gt;
&lt;br /&gt;
Open your registry editor and create the following registry key and value:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\SuppressUppercaseConversion&lt;br /&gt;
&lt;br /&gt;
REG_DWORD value: 1&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.richard-banks.org/2012/06/how-to-prevent-visual-studio-2012-all.html" target="_blank"&gt;Source&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
2)&amp;nbsp; Create and share Visual Studio color schemes&lt;br /&gt;
&lt;br /&gt;
The site &lt;a href="http://studiostyl.es/"&gt;http://studiostyl.es/&lt;/a&gt; has some Visual Studio color schemes that you can use, if the default are not as you like.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/FpgSkjNgmFA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/2249049526801544738/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=2249049526801544738&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/2249049526801544738?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/2249049526801544738?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/FpgSkjNgmFA/some-solutions-to-repair-visual-studio.html" title="Some solutions to repair the Visual Studio 2012 UI" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/08/some-solutions-to-repair-visual-studio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EERXo6fip7ImA9WhJXEko.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-8963518739886275919</id><published>2012-08-06T18:53:00.000+01:00</published><updated>2012-08-06T18:53:24.416+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-06T18:53:24.416+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2012" /><title>Migration from SQL server 2008 to 2012</title><content type="html">The company that I work at the present time has received the new SQL Sever hardware, so now is the time to upgrade from the SQL server 2008 to the 2012.&lt;br /&gt;
An upgrade, in this context,refers to the process of moving from the SQL server version 2008 to the new version 2012.&lt;br /&gt;
There are two approaches when upgrading:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;In-Place: The SQL Server is upgraded where it is currently installed&lt;/li&gt;
&lt;li&gt;Migration: A a new environment is installed, the data is copied to it and configured with the existing data. The content from SQL server 2008 must be migrated to the 2012 supported formats.&lt;/li&gt;
&lt;/ol&gt;
The approach I am going to take is the second, since I have a new hardware and I am going to do a fresh SQL Server 2012 installation. &lt;br /&gt;
&lt;br /&gt;
The migration from SQL server 2008 to 2012 must be well prepared and tested before going to production.&lt;br /&gt;
&lt;br /&gt;
I have to 
migrate several databases, the integration services (SSIS) packages, 
analisys services (SSAS) packages and reporting services (SSRS) reports.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;b&gt;Requirements&lt;/b&gt;&lt;/h2&gt;
This article assumes you already know the SQL Server database engine, integration services, analisys services, reporting services and it's tools.&lt;br /&gt;
Database administration knowledge is also important, like knowing what is a backup and a restore.&lt;br /&gt;
Some T-SQL knowledge is also assumed.&lt;br /&gt;
&lt;h2&gt;
&lt;b&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;h2&gt;
&lt;b&gt;Databases &lt;/b&gt;&lt;/h2&gt;
The database engine isn't a complete rewrite. This means that we can expect a deep compability level.&lt;br /&gt;
&lt;br /&gt;
There is an article on MSDN that explains the SQL Server Database Engine Backward Compatibility. You must read it &lt;a href="http://msdn.microsoft.com/en-us/library/ms143532" target="_blank"&gt;here&lt;/a&gt; to ensure that you ate not using a feature that breaks the SQL 2012 compatibility.&lt;br /&gt;
After reading the article and fixing any issues, the upgrade of the databases can be implemented in the following steps: &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create the databases and configure them on the SQL 2012 Server. If you 
don't have any special requirements skip this step, since when you perform the restore 
the databases are created automatically.&lt;br /&gt;Nevertheless, it is a good practice to think of the architecture of your databases e configure them accordingly.&lt;/li&gt;
&lt;li&gt;Backup the SQL Server 2008 databases and restored them in SQL 2012.&lt;/li&gt;
&lt;li&gt;Change each database compatibility level from 2008 to 2012. This action is important since it allows the usage of the new SQL Server 2012 features.&lt;br /&gt;The 
following script can be useful you you have several databases to 
migrate:&lt;br /&gt;&lt;br /&gt;USE [master]&lt;br /&gt;GO&lt;br /&gt;ALTER DATABASE [mydatabase] SET COMPATIBILITY_LEVEL = 110&lt;br /&gt;&lt;br /&gt;where [mydatabase] is the database to change the compatibility level&lt;br /&gt;&lt;br /&gt;or goto the database properties and on the options select the Compatibility Level 110.&lt;br /&gt; &lt;/li&gt;
&lt;li&gt;Check the logical and physical integrity of all the objects in the upgraded databases:&lt;br /&gt;&lt;br /&gt;DBCC CHECKDB([myDatabase]) WITH NO_INFOMSGS&lt;br /&gt;where [mydatabase] is the database to&amp;nbsp; run the integrity checks&lt;br /&gt;NO_INFOMSGS option&amp;nbsp; suppresses all informational messages. &lt;br /&gt;&lt;br /&gt;If If DBCC printed any error messages you must fix them so that your database will work correctly.&lt;/li&gt;
&lt;/ol&gt;
Don't forget to create the databases maintenance plans.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Integration Services (SSIS) &lt;/h2&gt;
In SQL Server 2012 the SSIS Package format changed and the specifications are now Open Source.&lt;br /&gt;
The Business Intelligence Development Studio (BIDs) is replaced by the SQL Server Data Tools (SSDT). &lt;br /&gt;
SQL Server 2012 SSIS offers a wizard for upgrading most of the solution components, but a few settings may be needed to be changed manually.&lt;br /&gt;
The wizard appears when you open a SQL Server 2008 package on the SQL Server data tools.&lt;br /&gt;
Microsoft has a white Paper that gives you 5 Tips for a Smooth SSIS Upgrade to SQL Server 2012. You can read it &lt;a href="http://msdn.microsoft.com/en-us/library/hh667275.aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
SSIS 2012 supports two deployment models:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Package deployment model: In this model the the unit of deployment is the package. This is the model used in previous versions of SSIS and is the default deployment model for upgraded packages.&lt;/li&gt;
&lt;li&gt;Project deployment model: . The unit of deployment is the project for this model. This model is new in SQL Server 2012 and provides additional package deployment and management features such as parameters and the Integration Services catalog&lt;/li&gt;
&lt;/ol&gt;
I have decided to use the Package deployment model for now, since it is the one the gives more compatibility with the SSIS 2008 model. When I have more time for testing and development I am going to convert to the Project deployment model. There is an wizard the performs this task and that is explained in the white paper I mentioned previously.&lt;br /&gt;
&lt;br /&gt;
The migration of the integration services (SSIS) packages&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Open the solution (sln) file with the packages to migrate&lt;/li&gt;
&lt;li&gt;The Visual Studio Conversion wizard appears. It is very simple and 
after a few next's pressed, the Package Management options appear.&lt;/li&gt;
&lt;li&gt;In the Package Management options select validate upgraded packages, so
 that the packages are validated and only the ones that pass validation 
are saved.&lt;/li&gt;
&lt;li&gt;Disable Ignore configurations, so that the configurations are validated during the upgrade process.&lt;/li&gt;
&lt;li&gt;The wizard ends the conversion and you can close it.&lt;/li&gt;
&lt;li&gt;Test each package and verify that it is working as expected. &lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
If there is a conversion error by the wizard, when you open the package in Visual Studio&amp;nbsp; it is immediately converted. This methodology allows that you can easly control the errors and correct them.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Analisys Services (SSAS)&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
The SSAS 2012 has a great deal of changes. The main new features are:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Business Intelligence Semantic Model &lt;/li&gt;
&lt;li&gt;Tabular model &lt;/li&gt;
&lt;li&gt;PowerPivot for Excel and Sharepoint&lt;/li&gt;
&lt;li&gt;SQL Server Data Tools (SSDT)&lt;/li&gt;
&lt;li&gt;Programmability with support for the new features&lt;/li&gt;
&lt;/ul&gt;
The options for migrating are:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Use only the multidimensional model&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Convert to the tabular model&lt;/li&gt;
&lt;li&gt;Use the multidimensional model for existing cubes and use the tabular model for new developments&lt;/li&gt;
&lt;li&gt;Use the tabular model or the multidimensional model depending on the project requirements&lt;/li&gt;
&lt;/ol&gt;
The conversion from the multidimensional model to the other models isn't supported by Microsoft at&amp;nbsp; the date this article was written. &lt;br /&gt;
The approach to keep the existing cubes in the multidimensional model is the one I selected, the main reasons are:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The existing cubes can be migrated to the SSAS 2012 multidimensional model, without any modifications.&lt;/li&gt;
&lt;li&gt;The existing reports and client tools will work without any problems &lt;/li&gt;
&lt;li&gt;The model is more mature and supports much higher data volumes&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The team has knowledge of this model and can continue the development without any significant changes&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
In the future I pretend to explore the new models, but for now the mature multidimensional model is the best option.&lt;br /&gt;
&lt;br /&gt;
The analysis services migration, with the selected approach, can be performed in the following simple steps : &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Open the solution (sln) file with the SSAS databases to migrate&lt;/li&gt;
&lt;li&gt;The Visual Studio Conversion wizard appears. The wizard doesn't have any options, so press Next and then Finish. &lt;/li&gt;
&lt;li&gt;Terminated the wizard and let it execute&lt;/li&gt;
&lt;li&gt;Deploy and process the SSAS database&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Test the SSAS database and confirm that everything is working as expected &lt;/li&gt;
&lt;/ol&gt;
The only issued I faced was that after processing I got the error:&lt;br /&gt;
&lt;br /&gt;
- Errors in the back-end database access module. The provider 'SQLNCLI10.1' is not registered.&lt;br /&gt;
- The following system error occurred:&amp;nbsp; Class not registered&lt;br /&gt;
&lt;br /&gt;
This error hints that there is a problem with the Data Sources connection string.&lt;br /&gt;
When I tried to open a data source the in project and pressed the edit button to edit the connection string, I got the error:&lt;br /&gt;
&lt;br /&gt;
"The specified provider is not supported. Please choose different provider in connection manager."&lt;br /&gt;
&lt;br /&gt;
The
 SQL Server 2008 Native Client is not installed in the Sql Server 2012 
server, so I changed the connection string provider to the native client
 11.0 and the issue was fixed.&lt;br /&gt;
&lt;br /&gt;
Another option, if strictly necessary, is to Download and install the SQL Server 2008 SQL Native Client or the SQL Server 2005 SQL Native Client, depending on the connection string provider you want to use.&lt;br /&gt;
&lt;br /&gt;
After his issue was fixed the processing occurred correctly and smoothly.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Reporting services (SSRS)&lt;/h2&gt;
&lt;br /&gt;
The SQL Server 2012 Reporting Services (SSRS) has two processing modes:&lt;br /&gt;
1) SSRS 2012 report processor. A report that is successfully converted to SSRS 2012 format is executed in this mode and can use the new SSRS features.&lt;br /&gt;
2)&amp;nbsp; Backward-compatibility mode processor. A report that cannot be converted to SSRS 2012 is processed in backward-compatibility mode and the new features are not available, but the report is still rendered.&lt;br /&gt;
You can find more information &lt;a href="http://msdn.microsoft.com/en-us/library/ms143747" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This approach by Microsoft gives a high degree of compatibility and I don't expect to have any issues in the migration.&lt;br /&gt;
The reporting services migration steps are:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Open the solution (sln) file with the reports to migrate&lt;/li&gt;
&lt;li&gt;The Visual Studio Conversion wizard appears. The wizard doesn't have any options, so press Next and then Finish.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;An information message may appear asking if you want to upgrade the report server project to the latest version. Press Yes &lt;/li&gt;
&lt;li&gt;Let the wizard execute.&lt;/li&gt;
&lt;li&gt;Open each data source and test the connection string. If there is an error fix it.&lt;/li&gt;
&lt;li&gt;Deploy the reports &lt;/li&gt;
&lt;li&gt;Test the reports and confirm that everything is working as expected &lt;/li&gt;
&lt;/ol&gt;
&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/24zhCqdIFLk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/8963518739886275919/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=8963518739886275919&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8963518739886275919?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8963518739886275919?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/24zhCqdIFLk/migration-from-sql-server-2008-to-2012.html" title="Migration from SQL server 2008 to 2012" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/08/migration-from-sql-server-2008-to-2012.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4FRXg_fSp7ImA9WhJQEkQ.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-7744991886156781783</id><published>2012-07-24T14:51:00.000+01:00</published><updated>2012-07-26T09:21:54.645+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-26T09:21:54.645+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net MVC" /><title>MVC jqGrid advanced scenario</title><content type="html">The MvcJqGrid is an Html Helper that eases greatly the implementation of the jqGrid in MVC 3 with the Razor view engine or MVC WebForms.&lt;br /&gt;
In my previous article (see &lt;a href="http://xprog.blogspot.pt/2012/07/aspnet-mvc-html-helper-for-jqgrid.html"&gt;here&lt;/a&gt;) I have explained a simple scenario to use the MvcJqGrid.
&lt;br /&gt;
&lt;br /&gt;
In a more advanced scenario, the  requested type preferred should be POST, since the default is GET. The SetRequestType method allows the defintion of the request type.
&lt;br /&gt;
The previous example uses an array that must return the values in the same order as the column definitions. A more generic solution is to return a json object with named properties. The MvcJqGrid supports this scenario by the SetJsonReader method.
&lt;br /&gt;
The SetJsonReader method is used to configure the grid jsonReader so that the json data doesn't have to match the column model (ColModel) order of jqGrid.
&lt;br /&gt;
Another feature that is advanced, is the capability to search in each desired column, using different search types. &lt;br /&gt;
The SetSearchType sets the seach type for the column. The seach type can be:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Input (Default)&lt;/li&gt;
&lt;li&gt;Select. The SetSearchTerms method receives the collection of strings that define the select options.&lt;/li&gt;
&lt;li&gt;Datepicker. The SetSearchDateFormat method allow the definition of the date format. &lt;/li&gt;
&lt;/ul&gt;
To enable the toolbar searching SetSearchToolbar must be set to true.&lt;br /&gt;
The SetSearchOnEnter is used to define when the search is executed:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;true : the search is executed when the user presses enter&lt;/li&gt;
&lt;li&gt;false: the search is executed after the user stops typing&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The SetRowList creates a dropdownlist in the pager of the grid with the specified number of rows per page.
&lt;br /&gt;
&lt;br /&gt;
Now we can create an example using the customer class.
&lt;br /&gt;
The view:
&lt;br /&gt;
&lt;pre class="brush:html"&gt;&lt;div style="width: 900px;"&gt;
@(Html.Grid("customerGrid")
    .SetRequestType(RequestType.Post)
    .SetJsonReader(new MvcJqGrid.DataReaders.JsonReader { Id="id", RepeatItems = false})
    .SetCaption("Customers")
    .AddColumn(new Column("FirstName").SetWidth(100).SetLabel("First Name"))
    .AddColumn(new Column("LastName").SetWidth(100).SetLabel("Last Name"))
    .AddColumn(new Column("CountryName").SetLabel("Country")
                          .SetSearchType(Searchtype.Select)
                          .SetSearchTerms((string[])ViewBag.Countries))
    .AddColumn(new Column("Phone").SetWidth(100))
    .AddColumn(new Column("BirthDate").SetWidth(80).SetSearchType(Searchtype.Datepicker)
                          .SetSearchDateFormat("yy-mm-dd"))
    .AddColumn(new Column("&amp;nbsp;").SetSearch(false).SetCustomFormatter("buttonize")
                                    .SetWidth(25)
                                    .SetAlign(Align.Right))
    .SetUrl(Url.Action("Search", "Customer"))
    .SetAutoWidth(true)
    .SetRowNum(10)
    .SetRowList(new[] { 10, 15, 20, 50 })
    .SetViewRecords(true)
    .SetPager("pager")
    .SetSearchToolbar(true).SetSearchOnEnter(false)     
    )
&lt;/div&gt;
&lt;/pre&gt;
&lt;br /&gt;
The SetCustomFormatter was explained previously and it allows to format the content of the column using a javascript function. 
&lt;br /&gt;
The controller that returns json with named properties:
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;public class CustomerController : Controller
{
    public ActionResult Index()
    {
        var countries = new CountryRepository().Search();
        ViewBag.Countries = (from c in countries select c.Name).ToArray();
        return View();
    }

    public JsonResult Search(GridSettings gridSettings)
    {
        List&amp;lt;CustomerSearchResult&amp;gt; customers = null;
        int totalRecords;
        CustomerRepository customerRepository = new CustomerRepository();
            
        CustomerSeachFilter filter = new CustomerSeachFilter();
        if (gridSettings.IsSearch)
        {
            filter.FirstName = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "FirstName") ? 
                    gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "FirstName").data : string.Empty;
            filter.LastName = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "LastName") ? 
                    gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "LastName").data : string.Empty;
            filter.CountryName = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "CountryName") ? 
                    gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "CountryName").data : string.Empty;
            filter.Phone = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "Phone") ? 
                    gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "Phone").data : string.Empty;
            filter.BirthDate = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "BirthDate") ? 
            filter.BirthDate = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "BirthDate") ? 
                    DateTime.ParseExact(gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "BirthDate").data, 
                                        "yyyy-MM-dd", null) : DateTime.MinValue;
        }

        customers = customerRepository.Search(filter, 
                                              gridSettings.SortColumn, 
                                              gridSettings.SortOrder, 
                                              gridSettings.PageSize, 
                                              gridSettings.PageIndex, 
                                              out totalRecords);

        var jsonData = new
        {
            total = totalRecords / gridSettings.PageSize + 1,
            page = gridSettings.PageIndex,
            records = totalRecords,
            rows = (
                from c in customers
                select new
                {
                    id = c.CustomerID,
                    FirstName = c.FirstName,
                    LastName = c.LastName,
                    BirthDate = c.BirthDate.ToString("yyyy-MM-dd"),
                    CountryName = c.CountryName,
                    EmailAddress = c.EmailAddress,
                    Phone = c.Phone,
                })
        };
        return Json(jsonData);
    }
}
&lt;/pre&gt;
The MvcJqGrid search feature also allows the configuration of the seach:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;SetSortName - Defines the default seach field for the grid.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;SetSortOrder - Defines the default sort order, using the SortOrder enumerator for the grid.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;SetDefaultSearchValue - Sets the default search value for a specific column.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/Zm5dbM5kRVs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/7744991886156781783/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=7744991886156781783&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7744991886156781783?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7744991886156781783?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/Zm5dbM5kRVs/mvc-jqgrid-advanced-scenario.html" title="MVC jqGrid advanced scenario" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/07/mvc-jqgrid-advanced-scenario.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUBRHY5cSp7ImA9WhJRF0Q.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-8290166598543902969</id><published>2012-07-20T14:15:00.000+01:00</published><updated>2012-07-20T14:17:35.829+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-20T14:17:35.829+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net MVC" /><title>MVC Data Annotation Validators - The Solution</title><content type="html">This "Problem - Solution" is a two series article . So this is the second part: The Solution.
&lt;br /&gt;
The first part explains the problems facing the implementation of the MVC Data Annotation Validators in a Service Oriented Architecture (SOA) with clear separation of the layers. You can read it &lt;a href="http://xprog.blogspot.pt/2012/07/mvc-data-annotation-validators-problem.html" target="_blank"&gt;here&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;
The solution I found is to use Fluent Validation framework with an Inversion of Control container (IoC) to instantiate my validators.
&lt;br /&gt;&lt;br /&gt;
The Fluent Validation framework is a validation engine that can be used in several scenarios. In this specific solution, I will be focusing in the integration with MVC without using any attributes.
&lt;br /&gt;
To use Fluent Validation with ASP.Net MVC I am going to use an Inversion of Control container to instantiate the validators. 
&lt;br /&gt;&lt;br /&gt;
The difference between an Inversion of Control (IoC) and any other kind of frameworks is that the control gets inverted. The objects in a application are controlled by the Inversion of Control Containers and the application is completely unaware of what the IoC does. A IoC container manages it's life-cycle, invoks methods and is fully autonomous form the application.
&lt;br /&gt;&lt;br /&gt;
The solution implemented by Fluent Validation is to use a custom Validator Factory.
&lt;br /&gt;
The process to implement can be described in the following steps:
&lt;br /&gt;
1) Create a Validator Factory for FluentValidation that inherits from ValidatorFactoryBase. Override the CreateInstance method to call the IoC container that is responsible for instantiating the validators. 
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
public class StructureMapValidatorFactory : ValidatorFactoryBase
{
    public override IValidator CreateInstance(Type validatorType)
    {
        return ObjectFactory.TryGetInstance(validatorType) as IValidator;
    }
}
&lt;/pre&gt;
&lt;br /&gt;
I am going to use StructureMap as the IoC Container.
&lt;br /&gt;
2) Create a StructureMap Controller Factory that inherits from the MVC DefaultControllerFactory.
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
public class StructureMapValidatorFactory : ValidatorFactoryBase
{
    public override IValidator CreateInstance(Type validatorType)
    {
        return ObjectFactory.TryGetInstance(validatorType) as IValidator;
    }
}
&lt;/pre&gt;
&lt;br /&gt;
3) Register your validator types with StructureMap, using the FluentValidation AssemblyScanner. The AssemblyScanner automatically registers all of the validator classes in a particular assembly with a IoC container.
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
public class MyRegistry : StructureMap.Configuration.DSL.Registry
{
    public MyRegistry()
    {
        FluentValidation.AssemblyScanner.FindValidatorsInAssemblyContaining&amp;lt;CustomerValidator&gt;()
            .ForEach(result =&gt;
            {
                For(result.InterfaceType)
                    .Singleton()
                    .Use(result.ValidatorType);
            });

    }
}
&lt;/pre&gt;
&lt;br /&gt;
4) Configure MVC to use FluentValidation MVC integration in Global.asax Application_Start
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);

    // Configure structuremap
    ObjectFactory.Configure(cfg =&gt; cfg.AddRegistry(new MyRegistry()));
    ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory());

    // Configure FluentValidation to use StructureMap
    var factory = new StructureMapValidatorFactory();

    // Tell MVC to use FluentValidation for validation
    ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(factory));
    DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
}
&lt;/pre&gt;
&lt;br /&gt;
5) Now the real fun can begin. The FluentValidation library can be used in MVC.
&lt;br /&gt;
Let's create a customer validator class, where the First Name and Last Name are mandatory and we also want to set a custom error message.&lt;br /&gt;
Also perform the same validation on the email and guarantee that the email follows the basic rules.
&lt;br /&gt;
The validation class must inherit from AbstractValidator.
&lt;br /&gt;
The rules are defined using  lambda expressions.
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
public class CustomerValidator : AbstractValidator&amp;lt;Customer&gt;
{
    public CustomerValidator()
    {
        RuleFor(customer =&gt; customer.FirstName).NotEmpty().WithMessage("Please fill the first name.");
        RuleFor(customer =&gt; customer.LastName).NotEmpty().WithMessage("Please fill the last name.");
        RuleFor(customer =&gt; customer.EmailAddress).EmailAddress().WithMessage("Please fill a valid email address.")
                                                    .NotEmpty().WithMessage("Please fill the first email.");
    }

}
&lt;/pre&gt;
&lt;br /&gt;
The FluentValidation has Built in Validators or you can define your custom validators.
&lt;br /&gt;
You can read more about the fluent validation &lt;a href="http://fluentvalidation.codeplex.com" target="_blank"&gt;here&lt;/a&gt;
&lt;br /&gt;
Structuremap download and documentation can be found &lt;a href="http://docs.structuremap.net" target="_blank"&gt;here&lt;/a&gt;
&lt;a href="http://www.codeproject.com" rel="tag" style="display:none"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/vlssQFIdj5o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/8290166598543902969/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=8290166598543902969&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8290166598543902969?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8290166598543902969?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/vlssQFIdj5o/mvc-data-annotation-validators-solution.html" title="MVC Data Annotation Validators - The Solution" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/07/mvc-data-annotation-validators-solution.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0ICQ3k_eSp7ImA9WhJRF0o.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-6852244250343630005</id><published>2012-07-19T13:34:00.001+01:00</published><updated>2012-07-20T09:06:02.741+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-20T09:06:02.741+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net MVC" /><title>MVC Data Annotation Validators - The Problem</title><content type="html">This "Problem - Solution" is a two series article . So this is the first: The Problem.
&lt;br /&gt;&lt;br /&gt;
Validating objects through metadata is the approach of Validation with the MVC Data Annotation concept.
&lt;br /&gt;
Metadata allows us to bind specific configurations to the business objects without changing or extending any of the objects implicit responsibilities. 
&lt;br /&gt;
In ASP.NET MVC, the concept is to use a specialized view model for each view and to pass the data needed. In this approach, the validation attributes must be placed in view model class.
&lt;br /&gt;
If you have a separation between each layer of the application, and that separation implies that you have different projects for each layer. The model can be defined by the classes generated by the entity framework in you data access layer or by your business layer.
&lt;br /&gt;&lt;br /&gt;
I have a database first approach using the Entity Framework and to use the MVC validation I could create a partial class with a MetadataType attribute to define the validator class. This is called a "buddy class".
&lt;br /&gt;
A simple example is:
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;
[MetadataType(typeof(CustomerMetadata))]
public partial class Customer
{
    // Class generated by the Entity Framework designer
}

public class CustomerMetadata
{
   [Required]
   public object Id;

   [Required]
   [StringLength(250)]
   public object FirstName;
}
&lt;/pre&gt;
&lt;br /&gt;
The above approach works great, but if you have service oriented architecture with WCF Services the validation attributes will be ignored by the WCF Serializer.
&lt;br /&gt;
The reason is obvious, the service and operation contracts are described by the Web Service Definition Language (WSDL), but the W3C specification doesn't support these attributes, so they are simple are ignored.&lt;br /&gt;
&lt;br /&gt;
Possible solutions to this problem are:&lt;br /&gt;
1) Using buddy classes for partial classes of the WCF proxy&lt;br /&gt;
2) Share an assembly with your entities between your WCF client and WCF service and reuse those types&lt;br /&gt;
&lt;br /&gt;
None of the above solutions are what I consider a good option and both will create tight coupling between your service and ASP.NET MVC application.
&lt;br /&gt;&lt;br /&gt;
Another problem I face is that I have a project with all my service Proxies that is referenced by the MVC application or any client.&lt;br /&gt;
Since you cannot have two partial classes referring to the same class in two different assemblies (projects) and I don't want to have MVC specific client side validation on my reusable proxy library, so another solution is in order.
&lt;br /&gt;&lt;br /&gt;
Above all i think that if you want to have client side validation you should to it on the client side. &lt;br /&gt;
The validation must be as simple as defining some rules that don't need to be associated directly with your model class.
&lt;br /&gt;&lt;br /&gt;
I also wanted to take advantage of all the MVC validation infrastructure with client and server side validation. I don't want to reinvent the wheel and develop all that code manually.
&lt;br /&gt;&lt;br /&gt;
The solution I found is to use Fluent Validation framework with an Inversion of Control container (IoC) to instantiate my validators.
&lt;br /&gt;
The Inversion of Control (IoC) pattern is all about removing dependencies from your code.
&lt;br /&gt;
Fluent Validation is a small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules for your business objects. 
&lt;br /&gt;
This post explains the problem, on my next post I will explain the implementation of Fluent Validation with MVC as the solution.
&lt;br /&gt;&lt;br /&gt;
Meanwhile if you can't wait, you can read about the fluent validation &lt;a href="http://fluentvalidation.codeplex.com" target="_blank"&gt;here&lt;/a&gt;
&lt;a href="http://www.codeproject.com" rel="tag" style="display:none"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/vwOV8LtDEA4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/6852244250343630005/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=6852244250343630005&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6852244250343630005?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6852244250343630005?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/vwOV8LtDEA4/mvc-data-annotation-validators-problem.html" title="MVC Data Annotation Validators - The Problem" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/07/mvc-data-annotation-validators-problem.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QNQ3w4fCp7ImA9WhJQEU4.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-5673901690731361642</id><published>2012-07-13T10:40:00.000+01:00</published><updated>2012-07-24T14:09:52.234+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-24T14:09:52.234+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net MVC" /><title>ASP.Net MVC Html Helper for the jqGrid</title><content type="html">The&amp;nbsp; jqGrid is a great grid with a lot of features, but the free version must be developed using JavaScript.&lt;br /&gt;
If you are developping in MVC, having a free Html Helper would be great.&lt;br /&gt;
This is where the MvcJqGrid enters.&lt;br /&gt;
&lt;br /&gt;
The MvcJqGrid is an Html Helper that eases greatly the implementation of the jqGrid in MVC 3 with the Razor view engine or MVC WebForms .&lt;br /&gt;
&lt;br /&gt;
To use the MvcJqGrid you can NuGet the package and then include the namespace in the view &lt;br /&gt;
&lt;pre class="brush:csharp"&gt;@using MvcJqGrid
@using MvcJqGrid.Enums
&lt;/pre&gt;
&lt;br /&gt;
or the web.config in the namespaces of the system.web.webPages.razor section.
&lt;br /&gt;
A simple example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;@(Html.Grid("CustomerGrid")
    .SetCaption("Customers")
    .AddColumn(new Column("CustomerId").SetLabel("Id"))
    .AddColumn(new Column("Name"))
    .AddColumn(new Column("Company"))
    .SetUrl(Url.Action("List","Customer"))
    .SetAutoWidth(true)
    .SetRowNum(10)
    .SetViewRecords(true)
    .SetPager("pager"))
&lt;/pre&gt;
&lt;br /&gt;
The Html is self explanatory:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Html.Grid("CustomerGrid") - Creates the grid with id CustomerGrid&lt;/li&gt;
&lt;li&gt;SetCaption - Sets the grid caption&lt;/li&gt;
&lt;li&gt;AddColumn - Adds the columns to the grid&lt;/li&gt;
&lt;li&gt;SetUrl - The Action and Controller that returns the json formatted for the jqGrid
SetLable - Sets the Label of the column that appears in the grid&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
A simple MVC controller for the grid is:&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;public ActionResult List(GridSettings gridSettings)
{
   CustomerRepository repository = new CustomerRepository();
   string name = string.Empty;
   string company = string.Empty;
            
   if (gridSettings.IsSearch)
   {
       name = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "Name") ? gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "Name").data : string.Empty;
        company = gridSettings.Where.rules.Any(r =&amp;gt; r.field == "Company") ? gridSettings.Where.rules.FirstOrDefault(r =&amp;gt; r.field == "Company").data : string.Empty;
    }

    var customers = repository.List(name, company, gridSettings.SortColumn, gridSettings.SortOrder);
    int totalCustomers = customers.Count;
    var jsonData = new
    {
        total = totalCustomers / gridSettings.PageSize + 1,
        page = gridSettings.PageIndex,
        records = totalCustomers,
        rows = (
                from c in customers
                select new
                {
                    id = c.CustomerID,
                    cell = new[]
                    {
                        c.CustomerID.ToString(),
                        string.Format("{0} {1}", c.FirstName, c.LastName),
                        c.CompanyName,
                        c.EmailAddress
                    }
        }).ToArray()
    };

    return Json(jsonData, JsonRequestBehavior.AllowGet);
}
&lt;/pre&gt;
A more complex example, with a column for operations like edit and delete is:
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;@(Html.Grid("CustomerGrid")
    .SetCaption("Customers")
    .AddColumn(new Column("CustomerId").SetLabel("Id").SetSearch(false))
    .AddColumn(new Column("Name"))
    .AddColumn(new Column("Company"))
    .AddColumn(new Column("EmailAddress").SetLabel("Email Address").SetSearch(false))
    .AddColumn(new Column("Last Modified").SetSearch(false))
    .AddColumn(new Column("Telephone").SetSearch(false))
    .AddColumn(new Column("&amp;nbsp;").SetSearch(false).SetCustomFormatter("buttonize").SetWidth(60).SetAlign(Align.Right))
    .SetUrl(Url.Action("List","Customer"))
    .SetAutoWidth(true)
    .SetRowNum(10)
    .SetRowList(new[] { 10, 15, 20, 50 })
    .SetViewRecords(true)
    .SetPager("pager")
    .SetSearchToolbar(true)
    .SetSearchOnEnter(false))
&lt;/pre&gt;
&lt;br /&gt;
Where buttonize is a javascript function where the operation column Html is returned.
&lt;br /&gt;
&lt;pre class="brush:javascript"&gt;   function buttonize(cellvalue, options, rowobject) {
        return '&lt;a href="http://xprog.blogspot.com/"&gt;eXtreme Programming&lt;/a&gt;';
    }
&lt;/pre&gt;
&lt;br /&gt;
For more information and live examples go to the MvcJqGrid site by pressing &lt;a href="http://playground.webpirates.nl/MvcJqGrid/Home/Formatters" target="_blank"&gt;here&lt;/a&gt;
&lt;br /&gt;
The about tab has the links to the license, the source code and documentation.

&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/CkUf7PW6l-E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/5673901690731361642/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=5673901690731361642&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/5673901690731361642?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/5673901690731361642?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/CkUf7PW6l-E/aspnet-mvc-html-helper-for-jqgrid.html" title="ASP.Net MVC Html Helper for the jqGrid" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/07/aspnet-mvc-html-helper-for-jqgrid.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YBSHY5cSp7ImA9WhVaFUw.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-1716360458826362317</id><published>2012-06-12T16:31:00.001+01:00</published><updated>2012-06-12T16:32:39.829+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-12T16:32:39.829+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Json" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>How to parse a ASP.Net JSON formatted date in C#</title><content type="html">ASP.Net serializes a date to JSON in a Microsoft specific format:
&lt;br /&gt;&lt;br /&gt;
/Date(1338505200000)/
&lt;br /&gt;&lt;br /&gt;
The value 1338505200000 is the number of milliseconds since January 1st 1970 UTC.
&lt;br /&gt;&lt;br /&gt;
The data can be parsed in C# removing the placeholders "/Date(" and ")/" and parsing it as:
&lt;br /&gt;&lt;br /&gt;
string jsonDate = "/Date(1338505200000)/";
jsonDate  = jsonDate .Replace("/Date(", string.Empty);
jsonDate = jsonDate.Replace(")/", string.Empty);
&lt;br /&gt;&lt;br /&gt;
var date = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(long.Parse(jsonDate));&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/GjJY7Xy320Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/1716360458826362317/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=1716360458826362317&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/1716360458826362317?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/1716360458826362317?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/GjJY7Xy320Q/how-to-parse-aspnet-json-formatted-date.html" title="How to parse a ASP.Net JSON formatted date in C#" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/06/how-to-parse-aspnet-json-formatted-date.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYBQ347eSp7ImA9WhVaFEQ.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-7275308551888750088</id><published>2012-06-12T11:42:00.000+01:00</published><updated>2012-06-12T11:49:12.001+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-12T11:49:12.001+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><title>jQuery Deferred for Asynchronous callbacks</title><content type="html">jQuery Deferred is a convenient way to perform Asynchronous callbacks.&lt;br /&gt;
For example, during the load of a page if you are performing a javaScript operation that takes some time to execute, an asynchronous callback can be used. The page will load without blocking.
&lt;br /&gt;&lt;br /&gt;
jQuery has the $.Deferred() feature that can register multiple callbacks and invoke them.
&lt;br /&gt;
The deferred.done() adds an handler to be called when the Deferred object is resolved (doneCallbacks).
&lt;br/&gt;
The deferred.resolve() resolves a Deferred object and calls any doneCallbacks with the given args. 
&lt;br /&gt;&lt;br /&gt;
The following code is an example usage:
&lt;pre class="brush:javascript"&gt;
var deferred = new $.Deferred();

deferred.done(function(message) { 
    // Put the code to execute asynchronously here
    alert(message);
});

deferred.resolve('"hello world!!!"');
&lt;/pre&gt;
There is a lot more about the Deferred Object in the jQuery documentation.&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/Kgi-6DAUQOY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/7275308551888750088/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=7275308551888750088&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7275308551888750088?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7275308551888750088?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/Kgi-6DAUQOY/jquery-deferred-for-asynchronous.html" title="jQuery Deferred for Asynchronous callbacks" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/06/jquery-deferred-for-asynchronous.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08EQH0zcSp7ImA9WhVbFUk.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-6872501998057290462</id><published>2012-06-01T11:38:00.001+01:00</published><updated>2012-06-01T12:23:21.389+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-01T12:23:21.389+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="KnockoutJS" /><title>KnockoutJS force viewModel update</title><content type="html">The KnockoutJS (KO) has a binding parameter named valueUpdate that defines which browser event KO should use to detect changes.&lt;br /&gt;
&lt;br /&gt;
The default is on change:

As the documentation says:

"change" (default)&lt;br /&gt;
- updates your view model when the user moves the focus to a different control, or in the case of select elements, immediately after any change&lt;br /&gt;
&lt;br /&gt;
Now let us say that you are using the jquery datepicker on a textbox.&lt;br /&gt;
After the date is selected the texbox has the value, but KO doesn't update the value on it's model, because there isn't any change event on the control.&lt;br /&gt;
&lt;br /&gt;
To force that KO updates the model for the date textbox, the change event must be fired:

&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$("#textboxID").trigger("change");
&lt;/pre&gt;
&lt;br /&gt;
Another possible solution is to  create a custom binding for the jQuery datepicker.

&lt;br /&gt;

The skeleton to specifiy a custom binding is:

&lt;br /&gt;
&lt;pre class="brush:html"&gt;
ko.bindingHandlers.myCustomBinding = {
    init: function(element, valueAccessor, allBindingsAccessor, viewModel) {

    },
    update: function(element, valueAccessor, allBindingsAccessor, viewModel) {

    }
};
&lt;/pre&gt;

You can create a datepicker binding:
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
ko.bindingHandlers.datepicker= {
    init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
      var parameters = allBindingsAccessor().datepickerParameters || {};
      $(element).datepicker(parameters);

       //handle the field changing
    },
    update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
       //handle the field changing
    }
};
&lt;/pre&gt;
&lt;br /&gt;
and use it as:

&lt;br /&gt;
&lt;pre class="brush:html"&gt;
&lt;input data-bind="datepicker: theDate, datepickerParameters: { ... }" /&gt;
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/-BWDJQ8rdLA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/6872501998057290462/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=6872501998057290462&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6872501998057290462?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6872501998057290462?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/-BWDJQ8rdLA/knockoutjs-force-viewmodel-update.html" title="KnockoutJS force viewModel update" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/06/knockoutjs-force-viewmodel-update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYHSH46fCp7ImA9WhJRF08.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-3837995442090058513</id><published>2012-05-29T13:56:00.000+01:00</published><updated>2012-07-19T19:38:59.014+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-19T19:38:59.014+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="KnockoutJS" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net MVC" /><title>Customer KnockoutJS Validation</title><content type="html">This article is the second on KnockoutJS series I am writing.&lt;br /&gt;
The first article was introductory: &lt;a href="http://xprog.blogspot.pt/2012/05/customer-knockoutjs-and-mvc-demo-using.html"&gt;Customer KnockoutJS and MVC demo using JSON&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now I am going to focus on KnockoutJS and validation.

I am going to use a KnockoutJS Plugin for model and property validation that is named Knockout Validation. You can download it from &lt;a href="https://github.com/ericmbarnard/Knockout-Validation" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The Asp.Net MVC Controller have the actions to Get and Add a customer. This example has a new customer property: the country. &lt;br /&gt;
This property allows to add an input type select to KnockoutJS and validation.&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;namespace KnockoutDemo.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "";

            return View();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public JsonResult Get(int customerID)
        {
            // Get the customer ...
            Customer customer = new Customer {CustomerID = customerID, 
                                              FirstName = "John", 
                                              LastName = "Doe", 
                                              IsMale = true, 
                                              CountryID = 1 };
            return Json(customer);
        }

        [HttpPost]
        public JsonResult Add(Customer customer)
        {
            // Save the customer ...

            // return status message 
            var message = string.Format("Customer: {0} {1} Added. IsMale: {2} Age:{3}  CountryID: {4} ",
                                        customer.FirstName, customer.LastName, customer.IsMale.ToString(), 
                                        customer.Age.ToString(), customer.CountryID.ToString());
            return Json(message);
        }

    }
}
&lt;/pre&gt;
&lt;br /&gt;
The Asp.Net MVC model is the customer with the new property:&lt;br /&gt;
&lt;pre class="brush:csharp"&gt; namespace KnockoutDemo.Models
{
    public class Customer
    {

        public int CustomerID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public bool IsMale { get; set; }
        public int Age { get; set; }
        public int CountryID { get; set; }
    }
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
The Asp.Net MVC Layout includes the new knockout validation plugin:
&lt;br /&gt;
&lt;pre class="brush:html"&gt;       
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
    &amp;lt;title&amp;gt;@ViewBag.Title&amp;lt;/title&amp;gt;
    &amp;lt;link href=&amp;quot;@Url.Content(&amp;quot;~/Content/Site.css&amp;quot;)&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; /&amp;gt;
    &amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/jquery-1.5.1.min.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/modernizr-1.7.min.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/knockout.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/json2.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src=&amp;quot;@Url.Content(&amp;quot;~/Scripts/knockout.validation.js&amp;quot;)&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class=&amp;quot;page&amp;quot;&amp;gt;
        &amp;lt;header&amp;gt;
            &amp;lt;div id=&amp;quot;title&amp;quot;&amp;gt;
                &amp;lt;h1&amp;gt;Knockout Demo&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
        &amp;lt;/header&amp;gt;
        &amp;lt;div&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
        &amp;lt;section id=&amp;quot;main&amp;quot;&amp;gt;
            @RenderBody()
        &amp;lt;/section&amp;gt;
        &amp;lt;footer&amp;gt;
        &amp;lt;/footer&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
And the Asp.Net MVC view has the KnockoutJS and validation specifics:
&lt;br /&gt;
&lt;pre class="brush:html"&gt;@{
    ViewBag.Title = "Add Customer";
}

&lt;style type="text/css"&gt;
.errorFill
{
    border:1px solid red;
    background-color: #fdd;
}
&lt;/style&gt;

&lt;h2&gt;@ViewBag.Message&lt;/h2&gt;
&lt;form action="" method="post"&gt;
&lt;b&gt;Customer Number: &lt;/b&gt; &lt;span data-bind="text: CustomerID"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;First Name: &lt;/b&gt;&lt;input data-bind="value: FirstName" style="width: 200px;" type="text" /&gt;
&lt;b&gt;Last Name: &lt;/b&gt;&lt;input data-bind="value: LastName" style="width: 200px;" type="text" /&gt;
&lt;b&gt;Age: &lt;/b&gt;&lt;input data-bind="value: Age" style="width: 200px;" type="text" /&gt;
&lt;input data-bind="checked: IsMale" type="checkbox" /&gt;&lt;b&gt;Male&lt;/b&gt;
&lt;b&gt;Country: &lt;/b&gt;&lt;select data-bind="options: CountryOptions, optionsValue: 'CountryID', optionsText: 'Name', value:CountryID, optionsCaption:'-- Country --'"&gt;&lt;/select&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;input data-bind="click: KnockoutDemoNamespace.addCustomer" type="button" value="Add Customer" /&gt;
    &lt;br /&gt;
&lt;div id="message"&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;script type="text/javascript"&gt;
// Initialized the namespace
var KnockoutDemoNamespace = {};

// View model declaration
KnockoutDemoNamespace.initViewModel = function (customer, countries) {
    var customerViewModel = ko.validatedObservable({
        CustomerID: ko.observable(customer.CustomerID),
        FirstName: ko.observable(customer.FirstName).extend({ required: true }),
        LastName: ko.observable(customer.LastName).extend({ required: true }),
        IsMale: ko.observable(customer.IsMale),
        Age: ko.observable(customer.Age).extend({ required: true }).extend({ number: true }),
        CountryID: ko.observable(customer.CountryID).extend({ required: true }),
        CountryOptions: ko.observableArray(countries)
    });

    var validationOptions = { insertMessages: true, decorateElement: true, errorElementClass: 'errorFill' };
    ko.validation.init(validationOptions);

    return customerViewModel;
}


// Bind the customer
KnockoutDemoNamespace.bindData = function (customer) {
    // get the country list
    KnockoutDemoNamespace.getCountries();
    
    // Create the view model
    KnockoutDemoNamespace.viewModel = KnockoutDemoNamespace.initViewModel(customer, KnockoutDemoNamespace.countries);
    ko.applyBindings(this.viewModel);
}


KnockoutDemoNamespace.getCountries = function () {
    $.ajax({
        url: "/Country/",
        type: 'post',
        contentType: 'application/json',
        cache: false,
        async: false,
        success: function (result) {
            KnockoutDemoNamespace.countries = result;
        },
        error: function (jqXHR, textStatus, errorThrown) {
            var errorMessage = '';
            $('#message').html(jqXHR.responseText);
        }
    });
}

KnockoutDemoNamespace.getCustomer = function (customerID) {
    $.ajax({
        url: "/Home/Get/",
        type: 'post',
        data: "{'customerID':'1' }",
        contentType: 'application/json',
        cache: false,
        success: function (result) {            
            KnockoutDemoNamespace.bindData(result);
        },
        error: function (jqXHR, textStatus, errorThrown) {
            var errorMessage = '';
            $('#message').html(jqXHR.responseText);
        }
    });
}

KnockoutDemoNamespace.addCustomer = function () {
    
    if (KnockoutDemoNamespace.viewModel.isValid()) {
        $.ajax({
            url: "/Home/Add/",
            type: 'post',
            data: ko.toJSON(this),
            contentType: 'application/json',
            success: function (result) {
                $('#message').html(result);
            }
        });
    }
}


    $(document).ready(function () {
        KnockoutDemoNamespace.getCustomer(1);

    });
&lt;/script&gt;
&lt;/pre&gt;
The KnockoutJS now has a observableArray of countries in the VewModel, that is bind to the country select.&lt;br /&gt;
Note the data-bind oprtions of the select:&lt;br /&gt;
- options: controls what options should appear in a drop-down lis&lt;br /&gt;
- optionsValue: The name of the ViewModel property to bind to the option value&lt;br /&gt;
- optionsText: The name of the ViewModel property to bind to the option text&lt;br /&gt;
- value: The name of the ViewModel property to bind to the selected value&lt;br /&gt;
- optionsCaption: The option that is used to make the user select a value on the select list &lt;br /&gt;
&lt;br /&gt;
There is also the validation plugin specifics in the VewModel declaration:&lt;br /&gt;
- The extend is used to extend the observables with the validation rules. (you can read about all of them &lt;a href="https://github.com/ericmbarnard/Knockout-Validation/wiki/Native-Rules" target="_blank"&gt;here&lt;/a&gt;)&lt;br /&gt;
In the example
I am using the required&amp;nbsp; (required: true) and number (number: true) validation rules.&lt;br /&gt;
- validatedObservable in the view model declaration&lt;br /&gt;
- isValid() - Before saving the data validate that the model is valid&lt;br /&gt;
- validation.init - Used to configure the validation engine&lt;br /&gt;
&lt;br /&gt;
In the example the invalid inputs are painted in red, that is where the css class is used by the validation. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/bHCR5n4CmLs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/3837995442090058513/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=3837995442090058513&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/3837995442090058513?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/3837995442090058513?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/bHCR5n4CmLs/customer-knockoutjs-validation.html" title="Customer KnockoutJS Validation" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/05/customer-knockoutjs-validation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcFSHs_fCp7ImA9WhJRF08.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-7350650557847788060</id><published>2012-05-07T14:41:00.001+01:00</published><updated>2012-07-19T19:36:59.544+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-19T19:36:59.544+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="KnockoutJS" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net MVC" /><title>Customer KnockoutJS and MVC demo using JSON</title><content type="html">After reading about KnockoutJS I have decided to create a simple demo using JSON to comunicate with the web server.&lt;br /&gt;
The application retrieves a Customer from an ASP.Net MVC Action and sends it to be saved.&lt;br /&gt;
&lt;br /&gt;
The KnockoutJS is a JavaScript Model View ViewModel (MVVM) framework.&lt;br /&gt;
The View Model object contains properties which values are specified as ko.observable(). Knockout will automatically updates the UI when the view model changes.&lt;br /&gt;
KnockoutJS has a declarative binding syntax where the HTML view elements are bind with our view model object. Knockout uses the "data-bind" attribute in the HTML elements for the data binding.&lt;br /&gt;
&lt;br /&gt;
To learn the basics goto the &lt;a href="http://knockoutjs.com/documentation/introduction.html%20" target="_blank"&gt;KnockoutJS site by pressing here &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Pr-requisites:&lt;br /&gt;
1) &lt;a href="http://knockoutjs.com/documentation/installation.html" target="_blank"&gt;KnockoutJS&lt;/a&gt;&lt;br /&gt;
2) &lt;a href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js" target="_blank"&gt;json2.js - for json parsing&lt;/a&gt;&lt;br /&gt;
3) ASP.NET MVC&lt;br /&gt;
4) jQuery
&lt;br /&gt;
&lt;br /&gt;
The Asp.Net MVC Controller have the actions to Get and Add a customer.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;namespace KnockoutDemo.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "";

            return View();
        }


        [AcceptVerbs(HttpVerbs.Post)]
        public JsonResult Get(int customerID)
        {
            // Get the customer ...
            Customer customer = new Customer {CustomerID = customerID, FirstName = "John", LastName = "Doe", IsMale = true };

            return Json(customer);
        }


        [HttpPost]
        public JsonResult Add(Customer customer)
        {
            // Save the customer ...

            // return status message 
            var message = "Customer: " + customer.FirstName + " " + customer.LastName + " Added.";
            message += " IsMale: " + customer.IsMale.ToString();
            return Json(message);
        }

    }
}
&lt;/pre&gt;
&lt;br /&gt;
The Asp.Net MVC model is the customer:&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;    public class Customer
    {
        public int CustomerID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public bool IsMale { get; set; }
    }
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
The Asp.Net MVC Layout:
&lt;br /&gt;
&lt;pre class="brush:html"&gt;    
 &amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;title&amp;gt;@ViewBag.Title&amp;lt;/title&amp;gt;
    &amp;lt;link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /&amp;gt;
    &amp;lt;script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="@Url.Content("~/Scripts/knockout.js")" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="@Url.Content("~/Scripts/json2.js")" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="@Url.Content("~/Scripts/knockout.validation.js")" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="page"&amp;gt;
        &amp;lt;header&amp;gt;
            &amp;lt;div id="title"&amp;gt;
                &amp;lt;h1&amp;gt;Knockout Demo&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
        &amp;lt;/header&amp;gt;
        &amp;lt;div&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
        &amp;lt;section id="main"&amp;gt;
            @RenderBody()
        &amp;lt;/section&amp;gt;
        &amp;lt;footer&amp;gt;
        &amp;lt;/footer&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
And finally the Asp.Net MVC view has the KnockoutJS specifics:
&lt;br /&gt;
&lt;pre class="brush:html"&gt;@{
    ViewBag.Title = "Add Customer";
}

&amp;lt;h2&amp;gt;
@ViewBag.Message&amp;lt;/h2&amp;gt;
&amp;lt;form action="" method="post"&amp;gt;
&amp;lt;b&amp;gt;Customer Number: &amp;lt;/b&amp;gt; &amp;lt;span data-bind="text: CustomerID"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;b&amp;gt;First Name: &amp;lt;/b&amp;gt;&amp;lt;input data-bind="value: FirstName" style="width: 200px;" type="text" /&amp;gt; &amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;b&amp;gt;Last Name: &amp;lt;/b&amp;gt;&amp;lt;input data-bind="value: LastName" style="width: 200px;" type="text" /&amp;gt; &amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;input data-bind="checked: IsMale" type="checkbox" /&amp;gt;&amp;lt;b&amp;gt;Male&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;input data-bind="click: KnockoutDemoNamespace.addCustomer" type="button" value="Add Customer" /&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;div id="message"&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/pre&gt;
&lt;pre class="brush:javascript"&gt;&lt;script type="text/javascript"&gt;
// Initialized the namespace
var KnockoutDemoNamespace = {};

// View model declaration
KnockoutDemoNamespace.initViewModel= function(customer) {
    var customerViewModel = {
        CustomerID: ko.observable(customer.CustomerID),
        FirstName: ko.observable(customer.FirstName),
        LastName: ko.observable(customer.LastName),
        IsMale: ko.observable(customer.IsMale)
    };
    return customerViewModel;
}

// Bind the customer
KnockoutDemoNamespace.bindData = function(customer)
{
    // Create the view model
    var viewModel = KnockoutDemoNamespace.initViewModel(customer);

    ko.applyBindings(viewModel);
}

KnockoutDemoNamespace.getCustomer = function (customerID) {

    $.ajax({
        url: "/Home/Get/",
        type: 'post',
        data: "{'customerID':'1' }",
        contentType: 'application/json',
        success: function (result) {
            KnockoutDemoNamespace.bindData(result);
        },
        error: function (jqXHR, textStatus, errorThrown) {
            var errorMessage = '';
            $('#message').html(jqXHR.responseText);
        }
    });

}

KnockoutDemoNamespace.addCustomer = function () {
        $.ajax({
            url: "/Home/Add/",
            type: 'post',
            data: ko.toJSON(this),
            contentType: 'application/json',
            success: function (result) {

                $('#message').html(result);
            }
        });
    }


    $(document).ready(function () {
        KnockoutDemoNamespace.getCustomer(1);

    });
&lt;/script&gt;
&lt;/pre&gt;
&lt;br /&gt;
The KnockoutJS has the following specifics:&lt;br /&gt;
1) View Model object: customerViewModel&lt;br /&gt;
2) HTML View: The HTML from the page with the KnockoutJS specific attributes for data binding&lt;br /&gt;
The demo performs a data bind with a span, and the input types text, checkbox and button. &lt;br /&gt;
Note that the "data-bind" has the html element attribute to be affected and the View Model property associated.&lt;br /&gt;
3) View Model activation: ko.applyBindings(viewModel);&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/OuXGZ01gto8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/7350650557847788060/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=7350650557847788060&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7350650557847788060?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/7350650557847788060?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/OuXGZ01gto8/customer-knockoutjs-and-mvc-demo-using.html" title="Customer KnockoutJS and MVC demo using JSON" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/05/customer-knockoutjs-and-mvc-demo-using.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEHRn8_fip7ImA9WhVVEEg.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-8888982503009104707</id><published>2012-05-03T15:17:00.000+01:00</published><updated>2012-05-03T15:17:17.146+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-03T15:17:17.146+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Receipts" /><title>Error deleting a file: Could not find this item. This is no longer located in</title><content type="html">When I was trying to delete a file I got a strange error:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Could not find this item.  This is no longer located in..."&lt;br /&gt;
&lt;br /&gt;
After some investigation I found the following solution:&lt;br /&gt;
1) Open a command prompt&lt;br /&gt;
2) Go to the folder where is the located the problematic file:&lt;br /&gt;
&amp;nbsp;&amp;nbsp; cd c:\temp&lt;br /&gt;
3) Type the command:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dir /x&lt;br /&gt;
4) Find the 8.3 filename&lt;br /&gt;
5) Delete the file using the command:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; del filenam~1.txt&lt;br /&gt;
&lt;br /&gt;
And bingo...the file is deleted !&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/IU0bQawTfP8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/8888982503009104707/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=8888982503009104707&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8888982503009104707?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8888982503009104707?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/IU0bQawTfP8/error-deleting-file-could-not-find-this.html" title="Error deleting a file: Could not find this item. This is no longer located in" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/05/error-deleting-file-could-not-find-this.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MFQHY6fCp7ImA9WhVWF0Q.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-6401376590571362135</id><published>2012-04-30T16:23:00.001+01:00</published><updated>2012-04-30T16:23:31.814+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-30T16:23:31.814+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="LINQ" /><title>T-SQL And Linq To Sql Reference: IN</title><content type="html">1. T-SQL&lt;br /&gt;
&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; select *   
 from Orders o  
 where ProductID IN (3, 4, 5)  
&lt;/code&gt;&lt;/pre&gt;

2. Linq

&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
 font-size: 13.3333px;
 font-width: 400;
 color: black;
 font-family: "Courier New";
}
.csharpcode pre { margin: 0px; }
.csharpcode .comment { color: #008000; }
.csharpcode .comment2 { color: #808080; }
.csharpcode .type { color: #2B91AF; }
.csharpcode .keyword { color: #0000FF; }
.csharpcode .string { color: #A31515; }
.csharpcode .preproc { color: #0000FF; }
&lt;/style&gt;
&lt;div class='csharpcode'&gt;Code:&lt;pre style='border:1px dashed #CCCCCC;overflow-x:auto;overflow-y:hidden;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height20px;color:#000000;word-wrap:normal;'&gt;&lt;span class='type'&gt;List&lt;/span&gt;&amp;lt;&lt;span class='keyword'&gt;int&lt;/span&gt;&amp;gt; filter = &lt;span class='keyword'&gt;new&lt;/span&gt; &lt;span class='type'&gt;List&lt;/span&gt;&amp;lt;&lt;span class='keyword'&gt;int&lt;/span&gt;&amp;gt;();  
filter.add(3);  
filter.add(4);  
filter.add(5);  
&lt;span class='type'&gt;var&lt;/span&gt; orders = &lt;span class='type'&gt;from&lt;/span&gt; o &lt;span class='keyword'&gt;in&lt;/span&gt; dc.Orders    
          &lt;span class='keyword'&gt;where&lt;/span&gt; filter.Contains(o.ProductID)  
          &lt;span class='type'&gt;select&lt;/span&gt; o;  &lt;/pre&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/_DvKOqbDJEg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/6401376590571362135/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=6401376590571362135&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6401376590571362135?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/6401376590571362135?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/_DvKOqbDJEg/t-sql-and-linq-to-sql-reference-in.html" title="T-SQL And Linq To Sql Reference: IN" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2012/04/t-sql-and-linq-to-sql-reference-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YNRHc9fSp7ImA9WhRQF0Q.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-2287384542729643558</id><published>2011-12-13T16:52:00.000Z</published><updated>2011-12-13T16:53:15.965Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-13T16:53:15.965Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="TSQL" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server" /><title>How to Convert rows to CSV in T-SQL</title><content type="html">&lt;pre class="csharpcode"&gt;To convert several rows to unique row in CSV using T-SQL, use the following code:&lt;/pre&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @myList &lt;span class="kwrd"&gt;varchar&lt;/span&gt;(&lt;span class="kwrd"&gt;MAX&lt;/span&gt;)
&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; @myList = &lt;span class="kwrd"&gt;coalesce&lt;/span&gt;(@myList + &lt;span class="str"&gt;','&lt;/span&gt;, &lt;span class="str"&gt;''&lt;/span&gt;) + UserName 
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; [&lt;span class="kwrd"&gt;User&lt;/span&gt;]

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; @myList&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/SbAlPDnpptY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/2287384542729643558/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=2287384542729643558&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/2287384542729643558?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/2287384542729643558?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/SbAlPDnpptY/how-to-convert-rows-to-csv-in-t-sql.html" title="How to Convert rows to CSV in T-SQL" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2011/12/how-to-convert-rows-to-csv-in-t-sql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIFQHkzeip7ImA9WhRQF0Q.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-8453794319442658512</id><published>2011-12-13T16:39:00.003Z</published><updated>2011-12-13T16:41:51.782Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-13T16:41:51.782Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>WCF: The maximum string content length quota (8192) has been exceeded</title><content type="html">A very annoying error I received when passing a very large string to a WCF Service was:&lt;br /&gt;
&lt;br /&gt;
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter . The InnerException message was 'There was an error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 8, position 9944.'. Please see InnerException for more details.&lt;br /&gt;
&lt;br /&gt;
This is a cryptic error and only after some investigation I found the solution:&lt;br /&gt;
&lt;br /&gt;
The readerQuotas element must be configured on the binding configuration:&lt;br /&gt;
&lt;br /&gt;

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="basicHttpBinding_IMyService"&lt;/span&gt; &lt;span class="attr"&gt;maxReceivedMessageSize&lt;/span&gt;&lt;span class="kwrd"&gt;="63400320"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;readerQuotas&lt;/span&gt; &lt;span class="attr"&gt;maxDepth&lt;/span&gt;&lt;span class="kwrd"&gt;="2147483647"&lt;/span&gt; &lt;span class="attr"&gt;maxStringContentLength&lt;/span&gt;&lt;span class="kwrd"&gt;="2147483647"&lt;/span&gt; &lt;span class="attr"&gt;maxArrayLength&lt;/span&gt;&lt;span class="kwrd"&gt;="2147483647"&lt;/span&gt;
       &lt;span class="attr"&gt;maxBytesPerRead&lt;/span&gt;&lt;span class="kwrd"&gt;="2147483647"&lt;/span&gt;   &lt;span class="attr"&gt;maxNameTableCharCount&lt;/span&gt;&lt;span class="kwrd"&gt;="2147483647"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;br /&gt;
This is a simple example, you must configure it for your own needs.&lt;br /&gt;
I have added the additional configuration elements to show the other options. &lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/n9VaDdAK50Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/8453794319442658512/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=8453794319442658512&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8453794319442658512?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/8453794319442658512?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/n9VaDdAK50Q/wcf-maximum-string-content-length-quota.html" title="WCF: The maximum string content length quota (8192) has been exceeded" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2011/12/wcf-maximum-string-content-length-quota.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YASXk_fSp7ImA9WhJRF0o.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-3045719464599946001</id><published>2011-12-13T15:20:00.000Z</published><updated>2012-07-20T08:59:08.745+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-20T08:59:08.745+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".Net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net 3.0" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ADO.Net" /><title>Bulk insert efficiently</title><content type="html">Using an ORM like Entity Framework or performing single inserts is not efficient to perform bulk operations.&lt;br /&gt;
To&amp;nbsp; bulk insert efficiently, the SqlBulkCopy class ADO.Net must be used.&lt;br /&gt;
&lt;br /&gt;
The SqlBulkCopy class is used to efficiently bulk load a Sql Server table with data from another sources.
&lt;br /&gt;
SQL Server has a command-prompt utility named bcp to also perform a bulk insert. The SqlBulkCopy is the equivalent for writing managed code.
&lt;br /&gt;
&lt;br /&gt;
The data source, like for example a flat file, can be converted to a generic list, that is the source of the SqlBulkCopy or a DataTable can be used directly.&lt;br /&gt;
&lt;br /&gt;
To bulk insert a generic list, it must be converted to a DataTable so that it can be used by the SqlBulkCopy:&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;public static DataTable ConvertToDataTable&amp;lt;T&gt;(IList&amp;lt;T&gt; list)
{
    PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(typeof(T));
    DataTable table = new DataTable();
    for (int i = 0; i &amp;lt; propertyDescriptorCollection.Count; i++)
    {
        PropertyDescriptor propertyDescriptor = propertyDescriptorCollection[i];
        Type propType = propertyDescriptor.PropertyType;
        if (propType.IsGenericType &amp;amp;&amp;amp; propType.GetGenericTypeDefinition() == typeof(Nullable&amp;lt;&amp;gt;))
        {
            table.Columns.Add(propertyDescriptor.Name, Nullable.GetUnderlyingType(propType));
        }
        else
        {
            table.Columns.Add(propertyDescriptor.Name, propType);
        }
    }
    object[] values = new object[propertyDescriptorCollection.Count];
    foreach (T listItem in list)
    {
        for (int i = 0; i &amp;lt; values.Length; i++)
        {
            values[i] = propertyDescriptorCollection[i].GetValue(listItem);
        }
        table.Rows.Add(values);
    }
    return table;
}
&lt;/pre&gt;
&lt;br /&gt;
Then the SqlBulkCopy can be used.&lt;br /&gt;
The steps to use the SqlBulkCopy are simple:&lt;br /&gt;
1) A SqlConnection open must be passed to it's constructor.&lt;br /&gt;
2) A DataTable must have the data to bulk insert &lt;br /&gt;
3) The mappings between the database columns and the DataTable must be defined, using the ColumnMappings propery.&amp;nbsp; The Column mappings define the relationships between columns in the data source and columns in the destination.&lt;br /&gt;
4) The DestinationTableName property must be set with the name of the destination table on the server.&lt;br /&gt;
5) The WriteToServer method copies all the rows of the DataTable to the specified destination table.&lt;br /&gt;
&lt;br /&gt;
In the following example the user table is bulk inserted, where dt is the DataTable  with the data to bulk insert.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;DataTable dt = new DataTable();
using (SqlConnection connection = new SqlConnection(connectionString))
{
    connection.Open();
    using (SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(connection))
    {
        sqlBulkCopy.ColumnMappings.Add("UserID", "UserID");
        sqlBulkCopy.ColumnMappings.Add("UserName", "UserName");
        sqlBulkCopy.ColumnMappings.Add("Password", "Password");
        sqlBulkCopy.DestinationTableName = "User";
        sqlBulkCopy.WriteToServer(dt);
    }
}&lt;/pre&gt;
The WriteToServer
method also supports a DataRow array or a IDataReader.&lt;br /&gt;
&lt;a href="http://www.codeproject.com/" rel="tag" style="display: none;"&gt;CodeProject&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/EB28iax81V0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/3045719464599946001/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=3045719464599946001&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/3045719464599946001?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/3045719464599946001?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/EB28iax81V0/how-to-bulk-insert-efficiently.html" title="Bulk insert efficiently" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2011/12/how-to-bulk-insert-efficiently.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEMQXc8fyp7ImA9WhRQEU0.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-5044447149440755081</id><published>2011-12-05T16:34:00.001Z</published><updated>2011-12-05T16:48:00.977Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-05T16:48:00.977Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="TSQL" /><title>Recover the mirror database</title><content type="html">Database mirroring is a software solution for increasing database availability.&lt;br /&gt;
Database mirroring maintains two copies of a single database that must 
reside on different server instances of SQL Server Database Engine.&lt;br /&gt;
When the mirror is removed from the Primary database the mirrored one sometimes doesn't recover and it says "Recovering".&lt;br /&gt;
If the database doesn't leave this state, the following TSQL command can help:&lt;br /&gt;
&lt;span id="ctl00_MTCS_main_ctl04"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class="libCScode" id="ctl00_MTCS_main_ctl04_code"&gt;RESTORE DATABASE myDatabase WITH RECOVERY&lt;/pre&gt;
&lt;pre class="libCScode" id="ctl00_MTCS_main_ctl04_code"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="libCScode" id="ctl00_MTCS_main_ctl04_code"&gt;This will allow to recover the former mirror database.&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/8nA1uXg5Csc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/5044447149440755081/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=5044447149440755081&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/5044447149440755081?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/5044447149440755081?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/8nA1uXg5Csc/recover-former-mirror-database.html" title="Recover the mirror database" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2011/12/recover-former-mirror-database.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8CSHg5fSp7ImA9WhRSEkU.&quot;"><id>tag:blogger.com,1999:blog-7673837.post-5112155943511099032</id><published>2011-11-14T15:16:00.001Z</published><updated>2011-11-14T15:17:49.625Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-14T15:17:49.625Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".Net 4.0" /><title>ValidateRequest=“false” doesn't work in Asp.Net 4</title><content type="html">Before Asp.Net 4.0 is some scenarios it was useful to disable the automatic request validation performed by the .Net Framework to prevent Script Attacks.&lt;br /&gt;
&lt;br /&gt;
This could be done by going to web.config or the page and setting&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;ValidateRequest="false"&lt;br /&gt;
&lt;br /&gt;
In Asp.Net 4.0 this feature only works if we set requestValidationMode="2.0" :&lt;br /&gt;
&lt;br /&gt;
&lt;system.web&gt;&lt;br /&gt;&lt;httpruntime requestvalidationmode="2.0"&gt;&lt;br /&gt;&lt;/httpruntime&gt;&lt;/system.web&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/eljWH/~4/ee3Pi6fwWb8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xprog.blogspot.com/feeds/5112155943511099032/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=7673837&amp;postID=5112155943511099032&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/5112155943511099032?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7673837/posts/default/5112155943511099032?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/eljWH/~3/ee3Pi6fwWb8/validaterequestfalse-doesnt-work-in.html" title="ValidateRequest=“false” doesn't work in Asp.Net 4" /><author><name>Rui Inacio</name><uri>https://plus.google.com/115922685890456008870</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-S0lwD2ubRQ0/AAAAAAAAAAI/AAAAAAAAAW4/s3RRRpreoM4/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xprog.blogspot.com/2011/11/validaterequestfalse-doesnt-work-in.html</feedburner:origLink></entry></feed>
