<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" 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" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5949924287482705652</atom:id><lastBuildDate>Sat, 24 Oct 2026 09:38:20 +0000</lastBuildDate><category>ASP.NET Interview Questions</category><category>ASP.NET</category><category>C#.NET and VB.NET Interview Questions</category><category>C#.NET</category><category>Interview Questions</category><category>SQL</category><category>SQL Interview Questions</category><category>java script</category><category>sqlserver</category><category>OOPs Interview Questions</category><category>Extension Methods</category><category>Framework</category><category>VB.NET</category><category>Visual Studio</category><category>Error</category><category>GridView</category><category>.NET Framework 4.0</category><category>.NET Framework 4.5</category><category>Design Patterns</category><category>XML</category><category>MVC3</category><category>ASP.NET MVC</category><category>JQuery</category><category>LINQ</category><category>WCF</category><category>Web Service</category><category>datetime</category><category>IIS</category><category>Browser</category><category>Crystal Report</category><category>Cloud</category><category>MVC2</category><category>Performance</category><category>Session</category><category>TextBox</category><category>Triggers</category><category>Authorization</category><category>CLR</category><category>CSS</category><category>Entity Framework</category><category>Generic</category><category>Master Pages</category><category>Threading</category><category>Windows Azure</category><category>silverlight</category><category>AJAX</category><category>AntiForgery</category><category>Appsetting</category><category>Architecture</category><category>CHM</category><category>Ckeditor</category><category>Code review</category><category>Connection String</category><category>Debugging</category><category>Design Principals</category><category>Enumerable</category><category>JScript</category><category>JScript.NET</category><category>JsonConvert</category><category>Lambda Expression</category><category>MVP</category><category>Membership</category><category>New Technologies</category><category>Observer Design Pattern</category><category>Partial View</category><category>Peer Code Review</category><category>Razor</category><category>SQL Injection</category><category>SQL Server 2012</category><category>SQL Server Errors</category><category>Security</category><category>Singleton</category><category>XAML</category><category>c#</category><category>programming</category><category>silverlight Interview Questions</category><category>xamarin</category><title>DOT NET ACADEMY</title><description>Dot Net Interview Questions and Tutorials&#xa;&#xa;By Dr. Rajesh Rolen</description><link>http://dotnetacademy.blogspot.com/</link><managingEditor>noreply@blogger.com (Dr. Rajesh Rolen)</managingEditor><generator>Blogger</generator><openSearch:totalResults>466</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-8384218973927337907</guid><pubDate>Sun, 12 Apr 2020 10:19:00 +0000</pubDate><atom:updated>2020-04-12T03:25:53.430-07:00</atom:updated><title>Development Practices Notes (RAW &amp; Incomplete)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Why Care About Code Quality?&lt;br /&gt;
We wanna be agile, what is agile means? &amp;nbsp;Agile means we gonna get the feedback from customer/PM and based on that feedback, we go back and respond to those changes. So that in the next PM meeting we can say that here are the changes, you wanted us to do last time, so review it and then we can move forward.&lt;br /&gt;
&lt;br /&gt;
AS sitting there with the customers and asking them what kind of change you need to make, you begin to realize that the particular change they want to make, if you were going to make, you will have to touch that peace of code, u remember the one that I am talking about, right? That peace of the code that u touch last time and u could not go home that weekend. U gonna quietly tell the customer, u know that’s not a good chance after all, because u don’t wanna spend yet another weekend at work.&lt;br /&gt;
So in another word, one of the main reasons to care about code quality is as simple as that u cannot be agile if your code sucks, so it&#39;s important for us to care about code quality. It doesn’t mean that just because you have the quality of code, u are agile, I am not saying that, right? I am saying that it will become really hard to be agile if your code sucks.&lt;br /&gt;
&lt;br /&gt;
Abelson &amp;amp; Sussman talk about his in their book, in the SICP book (Structure and Interpretation of Computer Programs),” programs must be written for people to read, and only incidentally for machines to execute”, so we all write code and we focus so much on writing code, so more than writing code, me must make sure that our code is readable, so now, why is this important for us to read someone’s code in our team? And the reason is, we write code just once but we have to maintain it continuously, and if we not gonna maintain the code then what is the point in writing that. And any code u write has to be maintained if somebody tells u that they&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code Reviews&lt;br /&gt;
Pair programming&lt;br /&gt;
Never get code reviewed by the non-programming person (manager or architect)&lt;br /&gt;
If managers are not doing programming then they can give more time to dev-testing and wiki documentation for functionality.&lt;br /&gt;
Beware of ticket only managers&lt;br /&gt;
Use UML Diagram in Architecture Design.&lt;br /&gt;
Appreciate person in CR and Arc meeting if he has done a good job.&lt;br /&gt;
1 to 1 meeting.&lt;br /&gt;
Don’t Interrogate&lt;br /&gt;
Don’t interview&lt;br /&gt;
Add many good points also&lt;br /&gt;
Ask for his problems (even if it&#39;s personal, it will help in building a good relationship)&lt;br /&gt;
BDD &amp;amp; TDD&lt;br /&gt;
Never show every task very urgent or critical (it will reduce the criticality of original critical tickets)&lt;br /&gt;
Never show your junior’s work on your name&lt;br /&gt;
Assign someone’s work to others just because the main person will come late… this will double to analysis time and will interrupt the other also&lt;br /&gt;
Variable names must be greater than two characters&lt;br /&gt;
Never apply lots of reporting tools and other monitoring on developers; it will end up in reducing performance instead.&lt;br /&gt;
&lt;br /&gt;
We all write code and we focus so much on writing code but more the writing code we must make sure that we are writing readable codes.&lt;br /&gt;
Now, why is that important to write the readable codes? And the reason is, we write code only once but we have to maintain it continuously.&lt;br /&gt;
If somebody tells you that they wrote the code once and they never changed the design or code. What they are telling is, the project/feature is canceled.&lt;br /&gt;
&lt;br /&gt;
How to write readable code?&lt;br /&gt;
Just write the code and give it to somebody to read it. And this is really important because even the original programmer has left the company, your code will still remain readable. It will reduce the maintenance time as well as, there will be no need to remember the code, as code is readable, it can be changed easily even after years. It is a kind of code review also.&lt;br /&gt;
You can fix the issue in non-readable code immediately after the code, maybe even after 3-4 days.. but later even after 3 weeks. If you try to fix the issue then you will have to first understand the whole scenario again. And what will happen, if you get the request to change the code after the year.&lt;br /&gt;
So we must write the code in such a readable form, so that it can be fixed by anyone in the team.&lt;br /&gt;
How to detect defects and how to reduce the defect (not talking about fixing the defect): adding features during development is 100 times cheaper than doing changes in the maintenance.&lt;br /&gt;
&lt;br /&gt;
40-50% of maintenance code is an avoidable rework&lt;br /&gt;
90% of the downtime of the projects comes for 10% code, bugs.&lt;br /&gt;
Never reintroduce the defects. Resolve the defect in a way that it should never come back with bugs. So you can save the re-fixing time&lt;br /&gt;
Code reviews and unit tests both are very important but code reviews have much more impact on the quality of product compare to unit tests.&lt;br /&gt;
As Code reviews make sure that your code is readable. As another mind reads your code and if that finds any issue in it, it will reject the code review.&lt;br /&gt;
Its extremely important that who is doing code review, now in your organization if only programmers write code and so-called architect or managers review the code. It is a very dangerous situation.&lt;br /&gt;
&lt;br /&gt;
The code reviewer should be a fellow programmer who is writing code with you, in the same team.&lt;br /&gt;
Such as non-coding architect and dev. managers are very dangerous for application if they are allowed to do code reviews&lt;br /&gt;
While doing a review, the reviewer must make sure the code has proper test coverage, it has written all required unit tests.&lt;br /&gt;
Disciplined practice can reduce the introduction of bugs and increase the quality of code.&lt;br /&gt;
We are not saying that discipline reduces defects, we are saying discipline reduces defect introduction.&lt;br /&gt;
We can see most of the company saying that we don’t have time to do it, we need to do it now, ASAP but they always have time to redo it. Programmers tell that we need the time or it going to take time and managers force that no we don’t have time, we need to fix it by today only, within a few hours. Then developers do the mesh and finish the work at the end of the day. But then what happens, that fast &amp;amp; furious code will be converted into multiple bugs and will take 20 times more time for bug fixing than it would have taken in initial development.&lt;br /&gt;
&lt;br /&gt;
People are making the same mistake again and again and expecting different results. To get a different result you will have to do the change, and meetings are not called change. An introduction of the new meeting will consume more time and things will go more bed instead of going positive.&lt;br /&gt;
Technical Debt: people take shortcuts during critical immediate issues and leave a few things in between knowingly. We must clear such technical debts ASAP.&lt;br /&gt;
Technical debt is not a wrong thing but resolving those technical debts is the issue. You must schedule the time to fix the technical debts. It must be part of your work and schedule. A dedicated time for fixing technical debts will increase the quality of code as well as reduce the upcoming defects and defect introductions.&lt;br /&gt;
Technical debts are just like your credit card, you do the shopping and when it’s time to pay, you just pay the minimum amount and continue doing shopping. After doing the same for continually for a few months you will reach to a place where u won’t be able to pay it and you will become bank corrupt. Same this is with technical debt, people keep doing it and once it goes beyond their limit, they silently switch the track/job and leave that tech debt for other people.&lt;br /&gt;
Freezing of the requirements: many people use this term that we have frozen the requirement but the real term is “We&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2020/04/development-practices-notes.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-2901764044757550011</guid><pubDate>Sat, 15 Sep 2018 07:56:00 +0000</pubDate><atom:updated>2018-09-15T00:56:08.333-07:00</atom:updated><title>Features from MVC2 vs MVC3 vs MVC4 vs MVC5 vs MVC6</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;box-sizing: border-box; caret-color: rgb(33, 33, 33); color: #212121; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;
&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MVC 2&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; caret-color: rgb(33, 33, 33); color: #212121; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;
&lt;ul style=&quot;box-sizing: border-box;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Customer Side Validation&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Templated Helpers&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Regions&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Nonconcurrent Controllers&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Html.ValidationSummary Helper Method&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;DefaultValueAttribute in real life Method Parameters&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Restricting Binary Data with Model Binders&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;DataAnnotations Attributes&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Demonstrate Validator Providers&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;New RequireHttpsAttribute Action Filter&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Templated Helpers&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Show Model-Level Errors&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;box-sizing: border-box; caret-color: rgb(33, 33, 33); color: #212121; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;
&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MVC 3&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; caret-color: rgb(33, 33, 33); color: #212121; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;
&lt;ul style=&quot;box-sizing: border-box;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Razor&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Readymade venture formats&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;HTML 5 empowered formats&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Support for Multiple View Engines&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;JavaScript and Ajax&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Demonstrate Validation Improvements&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;box-sizing: border-box;&quot;&gt;
&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MVC 4&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box;&quot;&gt;
&lt;ul style=&quot;box-sizing: border-box;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;ASP.NET Web API&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Revived and modernized default venture formats&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;New versatile venture format&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Numerous new highlights to help portable applications&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Upgraded bolster for nonconcurrent techniques&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;box-sizing: border-box;&quot;&gt;
&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MVC 5&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box;&quot;&gt;
&lt;ul style=&quot;box-sizing: border-box;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;One ASP.NET&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Trait based directing&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Asp.Net Identity&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Bootstrap in the MVC layout&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Confirmation Filters&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Channel supersedes&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;box-sizing: border-box;&quot;&gt;
&lt;strong style=&quot;box-sizing: border-box;&quot;&gt;MVC 6&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box;&quot;&gt;
&lt;ul style=&quot;box-sizing: border-box;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;ASP.NET MVC and Web API has been converged in to one.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Reliance infusion is inbuilt and part of MVC.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Next to each other - convey the runtime and structure with your application&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Everything is bundled with NuGet, Including the .NET runtime itself.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;New JSON based venture structure.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;No compelling reason to recompile for each change. Simply hit space and revive the program.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Accumulation finished with the new Roslyn ongoing compiler.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;vNext is Open Source by means of the .NET Foundation and is taking open commitments.&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;vNext (and Rosyln) additionally keeps running on Mono, on both Mac and Linux today.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Compiled By: Dr. Rajesh Rolen&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2018/09/features-from-mvc2-vs-mvc3-vs-mvc4-vs.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>595</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-5477299669173631863</guid><pubDate>Thu, 21 Apr 2016 10:33:00 +0000</pubDate><atom:updated>2016-04-21T04:08:32.126-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">xamarin</category><title> Could Not Find &#39;Xamarin.iOS&#39;</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

Error: Could Not Find &#39;Xamarin.iOS&#39;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj09gmYTQ-lABq8oN0HcJGfMBVw1sXLXVu4lHptwwCEDY-zB8rgpD_KJ9mfjaOzsULGAFde_Rbi2TnSAYMxNRyesCR6uCnVouYMuBEqByEJFZ1vyAku7ZqydUxKew8QCWTAj1nfrR_z78df/s1600/Could+not+find+xamarin.ios.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj09gmYTQ-lABq8oN0HcJGfMBVw1sXLXVu4lHptwwCEDY-zB8rgpD_KJ9mfjaOzsULGAFde_Rbi2TnSAYMxNRyesCR6uCnVouYMuBEqByEJFZ1vyAku7ZqydUxKew8QCWTAj1nfrR_z78df/s320/Could+not+find+xamarin.ios.png&quot; /&gt;&lt;/a&gt;

&lt;br /&gt;
You will get this error while building your xamarin ios/iphone/ipad project in visual studio.
&lt;br/&gt;
To build ios apps in visual studio you need xamarin installed (at least xamarin.ios) on a mac machine in same network and link to that machine in visual studio.
&lt;br/&gt;
you can link mac machine (xamarin installed on that) in visual studio from tools menu -&gt; options

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8JhzNS2B61-yQ_IWafpyQ1Fr05Zuvlsp6OO36Mrqvl7ecs9g7Qd3j1J3K5mQ5b4gzlRd00QIALdyzILW9tJIBxK31kTqSTo01Zcri95DvlF8rc8u63fAm2c16E2afUPipu3udG7fTsvLI/s1600/setup+xamarin+mac+agent.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8JhzNS2B61-yQ_IWafpyQ1Fr05Zuvlsp6OO36Mrqvl7ecs9g7Qd3j1J3K5mQ5b4gzlRd00QIALdyzILW9tJIBxK31kTqSTo01Zcri95DvlF8rc8u63fAm2c16E2afUPipu3udG7fTsvLI/s320/setup+xamarin+mac+agent.PNG&quot; /&gt;&lt;/a&gt;



&lt;br /&gt;


Compiled by: Dr. Rajesh Rolen
&lt;/div&gt;</description><link>http://dotnetacademy.blogspot.com/2016/04/could-not-find-xamarinios.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj09gmYTQ-lABq8oN0HcJGfMBVw1sXLXVu4lHptwwCEDY-zB8rgpD_KJ9mfjaOzsULGAFde_Rbi2TnSAYMxNRyesCR6uCnVouYMuBEqByEJFZ1vyAku7ZqydUxKew8QCWTAj1nfrR_z78df/s72-c/Could+not+find+xamarin.ios.png" height="72" width="72"/><thr:total>51</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-5959955601909829678</guid><pubDate>Tue, 25 Aug 2015 07:00:00 +0000</pubDate><atom:updated>2015-08-25T00:11:57.530-07:00</atom:updated><title>ASP.NET: failed to register url access denied</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
to resolve the error : failed to register url access denied&lt;br/&gt;
Solution:&lt;br/&gt;
use window + R to open RUN  &lt;br/&gt;
type below line in it and hit enter/run.
&lt;br/&gt;
netsh http delete urlacl url=http://*:62940/
&lt;/div&gt;</description><link>http://dotnetacademy.blogspot.com/2015/08/aspnet-failed-to-register-url-access.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>7</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-8939879872642644043</guid><pubDate>Thu, 12 Mar 2015 13:27:00 +0000</pubDate><atom:updated>2015-08-25T00:09:22.370-07:00</atom:updated><title>Cleans all views, SPS, functions PKs, FKs and tables</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;
/* Drop all non-system stored procs */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = &#39;P&#39; AND category = 0 ORDER BY [name])

WHILE @name is not null
BEGIN
    SELECT @SQL = &#39;DROP PROCEDURE [dbo].[&#39; + RTRIM(@name) +&#39;]&#39;
    EXEC (@SQL)
    PRINT &#39;Dropped Procedure: &#39; + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = &#39;P&#39; AND category = 0 AND [name] &gt; @name ORDER BY [name])
END
GO

/* Drop all views */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = &#39;V&#39; AND category = 0 ORDER BY [name])

WHILE @name IS NOT NULL
BEGIN
    SELECT @SQL = &#39;DROP VIEW [dbo].[&#39; + RTRIM(@name) +&#39;]&#39;
    EXEC (@SQL)
    PRINT &#39;Dropped View: &#39; + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = &#39;V&#39; AND category = 0 AND [name] &gt; @name ORDER BY [name])
END
GO

/* Drop all functions */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] IN (N&#39;FN&#39;, N&#39;IF&#39;, N&#39;TF&#39;, N&#39;FS&#39;, N&#39;FT&#39;) AND category = 0 ORDER BY [name])

WHILE @name IS NOT NULL
BEGIN
    SELECT @SQL = &#39;DROP FUNCTION [dbo].[&#39; + RTRIM(@name) +&#39;]&#39;
    EXEC (@SQL)
    PRINT &#39;Dropped Function: &#39; + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] IN (N&#39;FN&#39;, N&#39;IF&#39;, N&#39;TF&#39;, N&#39;FS&#39;, N&#39;FT&#39;) AND category = 0 AND [name] &gt; @name ORDER BY [name])
END
GO

/* Drop all Foreign Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;FOREIGN KEY&#39; ORDER BY TABLE_NAME)

WHILE @name is not null
BEGIN
    SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;FOREIGN KEY&#39; AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    WHILE @constraint IS NOT NULL
    BEGIN
        SELECT @SQL = &#39;ALTER TABLE [dbo].[&#39; + RTRIM(@name) +&#39;] DROP CONSTRAINT [&#39; + RTRIM(@constraint) +&#39;]&#39;
        EXEC (@SQL)
        PRINT &#39;Dropped FK Constraint: &#39; + @constraint + &#39; on &#39; + @name
        SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;FOREIGN KEY&#39; AND CONSTRAINT_NAME &lt;&gt; @constraint AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    END
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;FOREIGN KEY&#39; ORDER BY TABLE_NAME)
END
GO

/* Drop all Primary Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;PRIMARY KEY&#39; ORDER BY TABLE_NAME)

WHILE @name IS NOT NULL
BEGIN
    SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;PRIMARY KEY&#39; AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    WHILE @constraint is not null
    BEGIN
        SELECT @SQL = &#39;ALTER TABLE [dbo].[&#39; + RTRIM(@name) +&#39;] DROP CONSTRAINT [&#39; + RTRIM(@constraint)+&#39;]&#39;
        EXEC (@SQL)
        PRINT &#39;Dropped PK Constraint: &#39; + @constraint + &#39; on &#39; + @name
        SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;PRIMARY KEY&#39; AND CONSTRAINT_NAME &lt;&gt; @constraint AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    END
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = &#39;PRIMARY KEY&#39; ORDER BY TABLE_NAME)
END
GO

/* Drop all tables */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = &#39;U&#39; AND category = 0 ORDER BY [name])

WHILE @name IS NOT NULL
BEGIN
    SELECT @SQL = &#39;DROP TABLE [dbo].[&#39; + RTRIM(@name) +&#39;]&#39;
    EXEC (@SQL)
    PRINT &#39;Dropped Table: &#39; + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = &#39;U&#39; AND category = 0 AND [name] &gt; @name ORDER BY [name])
END
GO
&lt;/pre&gt;
&lt;/div&gt;</description><link>http://dotnetacademy.blogspot.com/2015/03/cleans-all-views-sps-functions-pks-fks.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-6048359166525999063</guid><pubDate>Wed, 10 Dec 2014 08:00:00 +0000</pubDate><atom:updated>2015-08-25T00:23:11.066-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.5</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">C#.NET and VB.NET Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">Entity Framework</category><category domain="http://www.blogger.com/atom/ns#">Error</category><title>&#39;System.Linq.IQueryable&#39; does not contain a definition for &#39;Include&#39; and no extension method &#39;Include&#39; accepting a first argument of type &#39;System.Linq.IQueryable&#39; could be found</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Error: &#39;System.Linq.IQueryable&lt;t&gt;&#39; does not contain a definition for &#39;Include&#39; and no extension method &#39;Include&#39; accepting a first argument of type &#39;System.Linq.IQueryable&lt;t&gt;&#39; could be found&lt;/t&gt;&lt;/t&gt;&lt;br /&gt;
&lt;t&gt;&lt;t&gt;&lt;br /&gt;&lt;/t&gt;&lt;/t&gt;
&lt;t&gt;&lt;t&gt;Solution:
Add namespace System.Data.Entity;&amp;nbsp;&lt;/t&gt;&lt;/t&gt;&lt;br /&gt;
&lt;t&gt;&lt;t&gt;Actually Include is not an extension method on Queryable, so it doesn&#39;t come with all the usual LINQ methods.&amp;nbsp;&lt;/t&gt;&lt;/t&gt;&lt;br /&gt;
&lt;t&gt;&lt;t&gt;If you are using Entity Framework, you need to import namespace System.Data.Entity:
&lt;/t&gt;&lt;/t&gt;&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2014/12/systemlinqiqueryable-does-not-contain.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-706698487009690799</guid><pubDate>Wed, 10 Dec 2014 07:31:00 +0000</pubDate><atom:updated>2014-12-09T23:32:30.122-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">C#.NET and VB.NET Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">Error</category><title>the type or namespace name &#39;expression&#39; could not be found</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To remove error &quot;the type or namespace name &#39;expression&#39; could not be found&quot;
Add namespace System.Linq.Expressions.
as normally System.Linq is there in using part by default and expression class is under system.Linq.Expressions so we have to make it also in using.
&lt;br /&gt;&lt;/div&gt;</description><link>http://dotnetacademy.blogspot.com/2014/12/the-type-or-namespace-name-expression.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-8706250656023969313</guid><pubDate>Fri, 07 Nov 2014 07:19:00 +0000</pubDate><atom:updated>2014-11-06T23:31:04.724-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">c#</category><category domain="http://www.blogger.com/atom/ns#">Code review</category><category domain="http://www.blogger.com/atom/ns#">Peer Code Review</category><category domain="http://www.blogger.com/atom/ns#">programming</category><title>Best Practices for Code Review</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;..http://support.smartbear.com/pdf/11_Best_Practices_for_Peer_Code_Review.pdf</description><link>http://dotnetacademy.blogspot.com/2014/11/best-practices-for-code-review.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-1863377450374048319</guid><pubDate>Fri, 07 Nov 2014 07:19:00 +0000</pubDate><atom:updated>2015-08-25T00:14:14.650-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">Error</category><title>The cast to value type &#39;Double&#39; failed because the materialized value is null. Either the result type&#39;s generic parameter or the query must use a nullable type</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

The cast to value type &#39;Double&#39; failed because the materialized value is null. Either the result type&#39;s generic parameter or the query must use a nullable type

OR

The cast to value type &#39;Int32&#39; failed because the materialized value is null. Either the result type&#39;s generic parameter or the query must use a nullable type
Solution:
Put conversion on values before putting it in functions like Avg, Sum etc 
like:
In below code we have put conversion to decimal in average function.

&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
var res =(from profile in dbModel.ProfileMasters
                                         select new
                                         {
                                             ProfileID = profile.ProfileId,
                                             Profile = profile.ClientName,
                                             Tasks= profile.TaskMasters.Count(),
                                             AverageTime = profile.TaskMasters.Select(x =&gt; EntityFunctions.DiffMinutes(x.StartTime, x.EndTime)).Average(y =&gt; (decimal?)y.Value),
                                             LastTime = profile.TaskMasters.Max(x=&gt;x.StartTime)
                                         }).ToList();

&lt;/pre&gt;</description><link>http://dotnetacademy.blogspot.com/2014/11/the-cast-to-value-type-double-failed.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-6700584751504920287</guid><pubDate>Fri, 07 Nov 2014 07:19:00 +0000</pubDate><atom:updated>2015-08-25T00:14:54.889-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">Lambda Expression</category><category domain="http://www.blogger.com/atom/ns#">LINQ</category><title>DbArithmeticExpression arguments must have a numeric common type</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

DbArithmeticExpression arguments must have a numeric common type

Solution:
we can&#39;t put datediff directly in linq / lambda.. instead of that we should use like : EntityFunctions.DiffMinutes


Eg:
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
              dgvProfiles.DataSource = (from profile in dbModel.ProfileMasters
                                         select new
                                         {
                                             ProfileID = profile.ProfileId,
                                             Profile = profile.ClientName,
                                             Tasks= profile.TaskMasters.Count(),
                                             AverageTime = profile.TaskMasters.Select(x =&gt; EntityFunctions.DiffMinutes(x.StartTime, x.EndTime)).Average(y =&gt; (decimal?)y.Value),
                                             LastTime = profile.TaskMasters.Max(x=&gt;x.StartTime)
                                         }).ToList();
&lt;/pre&gt;</description><link>http://dotnetacademy.blogspot.com/2014/11/dbarithmeticexpression-arguments-must.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-8976790019983692281</guid><pubDate>Thu, 03 Apr 2014 07:51:00 +0000</pubDate><atom:updated>2014-11-06T23:41:14.772-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.5</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">C#.NET and VB.NET Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">CLR</category><title>The maximum message size quota for incoming messages (65536) has been exceeded</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
System.ServiceModel.CommunicationException: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

Just increase the MaxReceivedMessageSize 
if its in client (who is accessing wcf ) then got to app config and change that size like:
                &lt;binding name=&quot;BasicHttpBinding_IFileTransferService&quot; transferMode=&quot;Streamed&quot; messageEncoding=&quot;Mtom&quot; maxBufferSize=&quot;1000000&quot; maxBufferPoolSize=&quot;10000000&quot; maxReceivedMessageSize=&quot;10067108864&quot;/&gt;
</description><link>http://dotnetacademy.blogspot.com/2014/04/the-maximum-message-size-quota-for.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-4531139027037529411</guid><pubDate>Wed, 26 Mar 2014 10:25:00 +0000</pubDate><atom:updated>2015-08-25T00:16:03.271-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">sqlserver</category><title>Change schema of all tables in database</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

To change schema of any table/stored procedure you can use this command:
ALTER SCHEMA NewSchemaName TRANSFER OldSchemaName.ObjectName

But when you want to change schema of all table/sp of a database then its not a good idea to write such lines for all objects.

better idea is to generate such script and then run it..

to generate such script for all tables, stored procedures and views, you can use below script.

&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;
SELECT &#39;ALTER SCHEMA NewSchemaName TRANSFER &#39; + SysSchemas.Name + &#39;.&#39; + DbObjects.Name + &#39;;&#39;
FROM sys.Objects DbObjects
INNER JOIN sys.Schemas SysSchemas ON DbObjects.schema_id = SysSchemas.schema_id
WHERE SysSchemas.Name = &#39;OldSchemaName&#39;
AND (DbObjects.Type IN (&#39;U&#39;, &#39;P&#39;, &#39;V&#39;))
&lt;/pre&gt;

now just copy the output of this script and run... 

&lt;h3&gt;Compiled by: Rajesh Rolen &lt;/h3&gt;</description><link>http://dotnetacademy.blogspot.com/2014/03/change-schema-of-all-tables-in-database.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-430444205122909465</guid><pubDate>Sat, 22 Mar 2014 13:07:00 +0000</pubDate><atom:updated>2015-08-25T00:17:50.092-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">Ckeditor</category><title>Prevent addition of default paragraph tag by ckeditor </title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

to prevent addition of default paragraph tag &lt;p&gt; by ckeditor we have to add below lines in config.js

&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
CKEDITOR.editorConfig = function (config) {
    config.enterMode = CKEDITOR.ENTER_BR;
    config.shiftEnterMode = CKEDITOR.ENTER_BR;
&lt;/pre&gt;</description><link>http://dotnetacademy.blogspot.com/2014/03/prevent-addition-of-default-paragraph.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-8971720034610416122</guid><pubDate>Thu, 13 Mar 2014 09:37:00 +0000</pubDate><atom:updated>2015-08-25T00:19:17.243-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><title>HTTP could not register URL . Your process does not have access rights to this namespace</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
HTTP could not register URL http://+:8080/FileTranfer/.&lt;br /&gt;
&lt;br /&gt;
Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The issue is that the URL is being blocked from being created by Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Steps to fix:&lt;br /&gt;
Run command prompt as an administrator.&lt;br /&gt;
&amp;nbsp;Add the URL to the ACL

netsh http add urlacl url=http://+:8080/FileTranfer/ user=mylocaluser&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2014/03/http-could-not-register-url-your.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-7335743614835596476</guid><pubDate>Sat, 22 Feb 2014 09:07:00 +0000</pubDate><atom:updated>2014-12-21T23:24:26.908-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.5</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">C#.NET and VB.NET Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">Connection String</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Entity Framework</category><title>set entity framework connection string programmatically</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

set entity framework connection string programmatically

Error: Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception

Solution:
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
   public static string GetConnectionString(ProfileMaster profile)
        {
            //return string.Format(&quot;data source={0};initial catalog={1};user id={2};password={3} multipleactiveresultsets=True;App=EntityFramework&quot;, profile.DatabaseIP, profile.DatabaseName, profile.UserName, profile.Password);
            string providerName = &quot;System.Data.SqlClient&quot;;
            string serverName = profile.DatabaseIP;
            string databaseName = profile.DatabaseName;

            // Initialize the connection string builder for the
            // underlying provider.
            SqlConnectionStringBuilder sqlBuilder =
            new SqlConnectionStringBuilder();

            // Set the properties for the data source.
            sqlBuilder.DataSource = serverName;
            sqlBuilder.InitialCatalog = databaseName;
            sqlBuilder.IntegratedSecurity = true;

            // Build the SqlConnection connection string.
            string providerString = sqlBuilder.ToString();

            // Initialize the EntityConnectionStringBuilder.
            EntityConnectionStringBuilder entityBuilder =
            new EntityConnectionStringBuilder();

            //Set the provider name.
            entityBuilder.Provider = providerName;

            // Set the provider-specific connection string.
            entityBuilder.ProviderConnectionString = providerString;

            // Set the Metadata location.
            entityBuilder.Metadata = @&quot;res://*/Models.MoviesDB.csdl|
                        res://*/Models.MoviesDB.ssdl|
                        res://*/Models.MoviesDB.msl&quot;;
            return entityBuilder.ToString();
        }
&lt;/pre&gt;

&lt;h3&gt; Compiled By: Rajesh Rolen &lt;/h3&gt;</description><link>http://dotnetacademy.blogspot.com/2014/02/set-entity-framework-connection-string.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-2617522463225992988</guid><pubDate>Sat, 18 Jan 2014 20:13:00 +0000</pubDate><atom:updated>2015-08-25T00:20:04.724-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">Debugging</category><category domain="http://www.blogger.com/atom/ns#">Error</category><title>Debugging Dll</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
System.Diagnostics.Debugger.Break();
&lt;/pre&gt;</description><link>http://dotnetacademy.blogspot.com/2014/01/debugging-dll.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-2438544209003099566</guid><pubDate>Sat, 18 Jan 2014 20:13:00 +0000</pubDate><atom:updated>2015-08-25T00:20:48.580-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">Enumerable</category><category domain="http://www.blogger.com/atom/ns#">Error</category><category domain="http://www.blogger.com/atom/ns#">JsonConvert</category><title>Error for enumerable when using JsonConvert.SerializeObject</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
[Serializable]
    public abstract class Entity
    {
        public Entity()
        {
        }

        public Entity(int id)
        {
            this.Id = id;
        }

        public virtual int Id { get; set; }

        public override bool Equals(object obj)
        {
            Entity other = (Entity)obj;
            return this.Id == other.Id;
        }

        public override int GetHashCode()
        {
            return this.Id.GetHashCode();
        }
    }
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2014/01/error-for-enumerable-when-using.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-5155847475310181030</guid><pubDate>Sat, 18 Jan 2014 20:12:00 +0000</pubDate><atom:updated>2014-11-06T23:33:20.277-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">java script</category><category domain="http://www.blogger.com/atom/ns#">JQuery</category><category domain="http://www.blogger.com/atom/ns#">Observer Design Pattern</category><title>Observer Design Pattern in Jquery</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

We can use observer design pattern (publisher - subscriber model) in jquery by triggering and attaching events.

&lt;pre name=&quot;code&quot; class=&quot;sql&quot;&gt;
Attach a trigger event for publisher
$(&#39;div&#39;).on(&#39;click&#39;, function(e) {
    $(this).trigger(&#39;MyEvent&#39;,e,parameterValue);
});


Attach subscriber methods
$(document).on(&#39;MyEvent&#39;, function(e,parameterValue) {
    //Do your stuffs with parameterValues..
});
&lt;/pre&gt;</description><link>http://dotnetacademy.blogspot.com/2014/01/observer-design-pattern-in-jquery.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-1315000346078830169</guid><pubDate>Mon, 13 Jan 2014 14:57:00 +0000</pubDate><atom:updated>2015-08-25T00:21:34.419-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Appsetting</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">C#.NET and VB.NET Interview Questions</category><title>Overwrite Appsetting in ASP.NET MVC</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;
  var config = WebConfigurationManager.OpenWebConfiguration(&quot;~&quot;);
  config.AppSettings.Settings[&quot;appSettingKey&quot;].Value =&quot;Updated value&quot;;
  config.Save(ConfigurationSaveMode.Minimal, false);
  ConfigurationManager.RefreshSection(&quot;appSettings&quot;);
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://dotnetacademy.blogspot.com/2014/01/overwrite-appsetting-in-aspnet-mvc.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-5721737640740875363</guid><pubDate>Sat, 15 Sep 2012 18:13:00 +0000</pubDate><atom:updated>2012-09-24T07:30:04.770-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">MVC3</category><category domain="http://www.blogger.com/atom/ns#">Partial View</category><title>MVC 3 Reload Partial View with Validations</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt; $(&#39;#partialcontroldiv&#39;).load(&#39;@Url.Content(&quot;~/ControlerName/ActionName&quot;)?id=&#39; + id, &#39;&#39;, function () {               
              //below lines to reapply dataannotation validation on partial view
                $(&#39;form&#39;).removeData(&quot;validator&quot;);
                $(&quot;form&quot;).removeData(&quot;unobtrusiveValidation&quot;);
                $.validator.unobtrusive.parse(document);


            });
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2012/09/mvc-3-reload-partial-view-with.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-1637427642499535765</guid><pubDate>Sat, 15 Sep 2012 18:13:00 +0000</pubDate><atom:updated>2012-09-24T07:30:48.295-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">MVC3</category><category domain="http://www.blogger.com/atom/ns#">Razor</category><title>MVC 3: Generate Textbox or labels in Foreach Loop</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
@foreach (var item in Model )&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@Html.LabelFor(a=&amp;gt; item.ItemName)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@Html.LabelFor(a =&amp;gt; item.Description)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@Html.LabelFor(a =&amp;gt; item.Qty)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@Html.TextBoxFor(a =&amp;gt; item.Price)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2012/09/mvc-3-generate-textbox-or-labels-in.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-6539012336795988917</guid><pubDate>Sat, 15 Sep 2012 18:13:00 +0000</pubDate><atom:updated>2012-09-24T07:31:36.584-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET Framework 4.0</category><category domain="http://www.blogger.com/atom/ns#">AntiForgery</category><category domain="http://www.blogger.com/atom/ns#">MVC3</category><category domain="http://www.blogger.com/atom/ns#">Security</category><title>MVC 3: Cross Site Request Forgery protection</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
write @Html.AntiForgeryToken() in view to generate any forgery token (hidden textbox)&lt;br /&gt;
and use [ValidateAntiForgeryToken] on action to validate that request has valid anti forgery token&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2012/09/mvc-3-cross-site-request-forgery.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-3821063544779782839</guid><pubDate>Sat, 15 Sep 2012 18:13:00 +0000</pubDate><atom:updated>2012-09-24T07:32:23.053-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">Authorization</category><category domain="http://www.blogger.com/atom/ns#">Membership</category><category domain="http://www.blogger.com/atom/ns#">MVC3</category><title>Change value of RequiresQuestionAndAnswer in ASP.NET Membership provider</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
MembershipUser user = Membership.GetUser();&lt;br /&gt;
string newPassword = &quot;newPass&quot;;&lt;br /&gt;
string tempPassword = string.Empty;&lt;br /&gt;
if (Membership.Provider.RequiresQuestionAndAnswer)&lt;br /&gt;
{&lt;br /&gt;
var _requiresQA = Membership.Provider.GetType().GetField(&quot;_RequiresQuestionAndAnswer&quot;,&lt;br /&gt;
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);&lt;br /&gt;
//change the value in the private field&lt;br /&gt;
_requiresQA.SetValue(Membership.Provider, false);&lt;br /&gt;
//do the reset&lt;br /&gt;
tempPassword = user.ResetPassword();&lt;br /&gt;
//set it&#39;s original value&lt;br /&gt;
_requiresQA.SetValue(Membership.Provider, true);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
tempPassword = user.ResetPassword();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
http://djsolid.net/blog/asp.net-membership---change-password-without-asking-the-old-with-question-and-answer&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2012/09/change-value-of-requiresquestionandansw.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-7904210450233516571</guid><pubDate>Sat, 15 Sep 2012 18:13:00 +0000</pubDate><atom:updated>2012-09-24T07:32:51.326-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C#.NET</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Singleton</category><title>Singleton Session</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
public class SingletonSession&lt;br /&gt;
{&lt;br /&gt;
// private constructor&lt;br /&gt;
private SingletonSession()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Gets the current session.&lt;br /&gt;
public static SingletonSession Current&lt;br /&gt;
{&lt;br /&gt;
get&lt;br /&gt;
{&lt;br /&gt;
SingletonSession session =&lt;br /&gt;
(SingletonSession)HttpContext.Current.Session[&quot;__SingletonSession__&quot;];&lt;br /&gt;
if (session == null)&lt;br /&gt;
{&lt;br /&gt;
session = new SingletonSession();&lt;br /&gt;
HttpContext.Current.Session[&quot;__SingletonSession__&quot;] = session;&lt;br /&gt;
}&lt;br /&gt;
return session;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// **** add your session properties here, e.g like this:&lt;br /&gt;
&lt;br /&gt;
public Guid UserId { get; set; }&lt;br /&gt;
public string UserName { get; set; }&lt;br /&gt;
public string AccountNo { get; set; }&lt;br /&gt;
public MembershipUser User { get; set; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2012/09/singleton-session.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5949924287482705652.post-3404312081546828419</guid><pubDate>Sat, 15 Sep 2012 18:12:00 +0000</pubDate><atom:updated>2012-09-24T07:29:27.991-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET Interview Questions</category><category domain="http://www.blogger.com/atom/ns#">Authorization</category><category domain="http://www.blogger.com/atom/ns#">MVC3</category><title>Authorization and Permission using Attribute in MVC3</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Public enum PermissionType&lt;br /&gt;
{&lt;br /&gt;
permission1,&lt;br /&gt;
permission2,&lt;br /&gt;
permissiontype3&lt;br /&gt;
}&lt;br /&gt;
public class AuthorizePermissionAttribute : AuthorizeAttribute&lt;br /&gt;
{&lt;br /&gt;
private readonly IRolesService _rolesService;&lt;br /&gt;
private readonly IUserService _userService;&lt;br /&gt;
private string[] _rolesSplit;&lt;br /&gt;
private string[] _usersSplit;&lt;br /&gt;
public PermissionType[] PermissionName;&lt;br /&gt;
public AuthorizePermissionAttribute()&lt;br /&gt;
: this(new AspNetMembershipProviderWrapper(), new AspNetRoleProviderWrapper())&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
public AuthorizePermissionAttribute(IUserService userService, IRolesService rolesService)&lt;br /&gt;
{&lt;br /&gt;
_userService = userService;&lt;br /&gt;
_rolesService = rolesService;&lt;br /&gt;
}&lt;br /&gt;
public AuthorizePermissionAttribute(PermissionType[] PermissionName)&lt;br /&gt;
: this(new AspNetMembershipProviderWrapper(), new AspNetRoleProviderWrapper())&lt;br /&gt;
{&lt;br /&gt;
this.PermissionName = PermissionName;&lt;br /&gt;
}&lt;br /&gt;
protected override bool AuthorizeCore(HttpContextBase httpContext)&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var user = httpContext.User;&lt;br /&gt;
if (!user.Identity.IsAuthenticated)&lt;br /&gt;
return false;&lt;br /&gt;
&lt;br /&gt;
if (_usersSplit == null)&lt;br /&gt;
_usersSplit = SplitString(Users);&lt;br /&gt;
if (_rolesSplit == null)&lt;br /&gt;
_rolesSplit = SplitString(Roles);&lt;br /&gt;
&lt;br /&gt;
if (_usersSplit.Any() &amp;amp;&amp;amp; !_usersSplit.Contains(user.Identity.Name, StringComparer.OrdinalIgnoreCase))&lt;br /&gt;
return false;&lt;br /&gt;
&lt;br /&gt;
//if (!_rolesService.Enabled || !_rolesSplit.Any())&lt;br /&gt;
//    return true;&lt;br /&gt;
&lt;br /&gt;
//return _rolesSplit.Any(user.IsInRole);&lt;br /&gt;
&lt;br /&gt;
IEnumerable&lt;string&gt; userroles = _rolesService.FindByUser(MySession.Current.User);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var roleids = _context.aspnet_Roles.Where(a =&amp;gt; userroles.Contains(a.RoleName)).Select(a =&amp;gt; a.RoleId);&lt;br /&gt;
var rpt = _context.Role_Permission_Trans.Where(a =&amp;gt; roleids.Contains(a.RoleID)).Select(a =&amp;gt; a.PID);&lt;br /&gt;
var pm = _context.PermissionMasters.Where(p =&amp;gt; rpt.Contains(p.PID));&lt;br /&gt;
var permissions = PermissionName.ToString(&quot;,&quot;).ToLower().Split(&quot;,&quot;.ToCharArray());&lt;br /&gt;
var res = pm.Where(p =&amp;gt; permissions.Contains(p.PermissionName.ToLower()));&lt;br /&gt;
if (res.IsNotNull() &amp;amp;&amp;amp; res.Count() &amp;gt; 0)&lt;br /&gt;
{&lt;br /&gt;
return true;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
catch (Exception)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
return false;&lt;br /&gt;
//return base.AuthorizeCore(httpContext);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
private static string[] SplitString(string original)&lt;br /&gt;
{&lt;br /&gt;
if (String.IsNullOrEmpty(original))&lt;br /&gt;
return new string[0];&lt;br /&gt;
&lt;br /&gt;
var split = from piece in original.Split(&#39;,&#39;)&lt;br /&gt;
let trimmed = piece.Trim()&lt;br /&gt;
where !String.IsNullOrEmpty(trimmed)&lt;br /&gt;
select trimmed;&lt;br /&gt;
return split.ToArray();&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class LogonAuthorize : AuthorizeAttribute&lt;br /&gt;
{&lt;br /&gt;
public override void OnAuthorization(AuthorizationContext filterContext)&lt;br /&gt;
{&lt;br /&gt;
if (!(filterContext.Controller is AccountController) &amp;amp;&amp;amp; !(filterContext.Controller is HomeController))&lt;br /&gt;
base.OnAuthorization(filterContext);&lt;br /&gt;
}&lt;br /&gt;
}&lt;/string&gt;&lt;/div&gt;
</description><link>http://dotnetacademy.blogspot.com/2012/09/authorization-and-permission-using.html</link><author>noreply@blogger.com (Dr. Rajesh Rolen)</author><thr:total>0</thr:total></item></channel></rss>