<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='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'><id>tag:blogger.com,1999:blog-6122772622766163989</id><updated>2024-09-02T13:08:53.555+10:00</updated><category term="C#"/><category term="sql"/><category term="Entity Framework"/><category term="css"/><category term="t-sql"/><category term="Lambda Expressions"/><category term="asp.net"/><category term="html"/><category term="jquery"/><category term="CQS"/><category term="DataContractSerializer"/><category term="Extension methods"/><category term="Glimpse"/><category term="Helios"/><category term="Katana"/><category term="LINQ"/><category term="MVC"/><category term="Microsoft Light Switch"/><category term="Node.js"/><category term="OData"/><category term="OWIN"/><category term="POCO"/><category term="POCO Entities"/><category term="Repository Pattern"/><category term="Silverlight"/><category term="WCF"/><category term="WCF Data Services"/><category term="WCF services"/><category term="XAP file"/><category term="XmlSerializer"/><category term="aggregate functions"/><category term="application library caching"/><category term="bitwise"/><category term="check"/><category term="command query separation"/><category term="connect-owin"/><category term="content"/><category term="css framework"/><category term="css media queries"/><category term="debugging"/><category term="decrease size"/><category term="delimited string"/><category term="design principle"/><category term="enum"/><category term="flag"/><category term="hosting owin applications"/><category term="inheritance"/><category term="life cycle"/><category term="mobile friendly"/><category term="over"/><category term="over clause"/><category term="page life cycle"/><category term="parse convert string to enum c#"/><category term="percentage"/><category term="progress"/><category term="progress bar"/><category term="ranking functions"/><category term="reduce size"/><category term="scroll"/><category term="scroller"/><category term="scrolling"/><category term="sql server"/><category term="string is empty"/><category term="string is null"/><category term="t4 editor"/><category term="t4 template"/><category term="table column"/><category term="tools"/><category term="vertical"/><category term="viewport"/><title type='text'>.NET Journey</title><subtitle type='html'>Interesting topics, tips and tricks in different facets of .NET design and development.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-1172705047697832876</id><published>2014-07-13T18:01:00.000+10:00</published><updated>2014-07-13T18:01:37.853+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="connect-owin"/><category scheme="http://www.blogger.com/atom/ns#" term="Helios"/><category scheme="http://www.blogger.com/atom/ns#" term="hosting owin applications"/><category scheme="http://www.blogger.com/atom/ns#" term="Katana"/><category scheme="http://www.blogger.com/atom/ns#" term="Node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="OWIN"/><title type='text'>OWIN - Katana Web Application</title><content type='html'>&lt;a href=&quot;http://owin.org/&quot;&gt;OWIN&lt;/a&gt; defines the standard interface between .NET web servers and web applications. KATANA is OWIN implementation for Microsoft servers and frameworks. 
&lt;p&gt;
If you are not familiar with Katana, read this article &lt;a href=&quot;http://www.asp.net/aspnet/overview/owin-and-katana/an-overview-of-project-katana&quot;&gt;An Overview of Project Katana&lt;/a&gt; which talks about the history and goals behind OWIN/Katana.
&lt;/p&gt;

&lt;p&gt;
In this post I want highlight Katana&#39;s architecture around decoupling host and server from the application.
&lt;/p&gt;

&lt;h1&gt;Katana Architecture&lt;/h1&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTf_Hg90fa8wjTqJ7j0WeM4q_Fn4nww4rJnU1TU5ZAbrL7m3MfvnOvBquiII0vXzc47pFkIKeNN8p_tJAJ-2BlL6c2zDjDpmw-xeQ12rEqz5o5tlOX_Pu-UXaUjnVc736kwRQk_NF8RcVF/s1600/Katana+Architecture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTf_Hg90fa8wjTqJ7j0WeM4q_Fn4nww4rJnU1TU5ZAbrL7m3MfvnOvBquiII0vXzc47pFkIKeNN8p_tJAJ-2BlL6c2zDjDpmw-xeQ12rEqz5o5tlOX_Pu-UXaUjnVc736kwRQk_NF8RcVF/s320/Katana+Architecture.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
Lets look at some hosting options for OWIN application
&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;Custom Host:&lt;/b&gt; You can host owin application in a console application or OwinHost (prebuilt Katana host) using Microsoft.Owin.Host.HttpListner.
&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;IIS:&lt;/b&gt; Owin applications can be hosted in IIS using Microsoft.Owin.Host.SystemWeb server package. Unfortunately with this package, you do not get a lean host as it adds the standard ASP.NET piple. Thats where &lt;a href=&quot;http://blogs.msdn.com/b/webdev/archive/2014/02/18/introducing-asp-net-project-helios.aspx&quot;&gt;Helios&lt;/a&gt; comes to rescue where we can get all the benefits of IIS without the traditional ASP.NET pipeline.
&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;Node.js:&lt;/b&gt; Using connect-owin middleware, we can host Owin application in Node.js too.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
I have created a demo web api application which highlights how easy it is to switch between different hosts without changing your application. The source code is available &lt;a href=&quot;https://bitbucket.org/gsblue/owin-demo&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/1172705047697832876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2014/07/owin-katana-web-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/1172705047697832876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/1172705047697832876'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2014/07/owin-katana-web-application.html' title='OWIN - Katana Web Application'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTf_Hg90fa8wjTqJ7j0WeM4q_Fn4nww4rJnU1TU5ZAbrL7m3MfvnOvBquiII0vXzc47pFkIKeNN8p_tJAJ-2BlL6c2zDjDpmw-xeQ12rEqz5o5tlOX_Pu-UXaUjnVc736kwRQk_NF8RcVF/s72-c/Katana+Architecture.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-1012369647533040738</id><published>2013-09-15T21:34:00.000+10:00</published><updated>2013-09-15T21:37:44.795+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="debugging"/><category scheme="http://www.blogger.com/atom/ns#" term="Glimpse"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="tools"/><title type='text'>Glimpse - ASP.NET Debugging</title><content type='html'>As the name suggests &lt;a href=&quot;http://getglimpse.com/&quot;&gt;Glimpse&lt;/a&gt; allows you to glimpse into what is happening on server side of your ASP.NET application. It can save you lot of time whilst debugging by providing plethora of information and also help you learn and understand the internal mechanics of ASP.NET.
&lt;p&gt;
You can install Glimpse using Nuget. Ensure you install the right packages for ASP.NET and the features you want use.
&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9iQ7ABoSyUFI-48yq0FtnOpTl8smcdXxnKN6QJWCfVqPaG_ty1x0C411HBATadwAGzVbNcaH6sF8zWYbAo_3ktqmNTltJW-H-ey0KihPIML2Fh0lP8dGA0_cOIrG2FsBX0kC0VHlFzmr3/s1600/glimpse_nuget.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9iQ7ABoSyUFI-48yq0FtnOpTl8smcdXxnKN6QJWCfVqPaG_ty1x0C411HBATadwAGzVbNcaH6sF8zWYbAo_3ktqmNTltJW-H-ey0KihPIML2Fh0lP8dGA0_cOIrG2FsBX0kC0VHlFzmr3/s640/glimpse_nuget.png&quot; /&gt;&lt;/a&gt;
&lt;p&gt;
You can also use the package manager console to install Glimpse
&lt;/p&gt;
&lt;/p&gt;
&lt;code&gt;
install-package Glimpse.MVC4&lt;/br&gt;
install-package Glimpse.EF5
&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Glimpse is quite extensible and there are many &lt;a href=&quot;http://getglimpse.com/Packages&quot;&gt;other packages&lt;/a&gt; available from the community.
&lt;/p&gt;
&lt;p&gt;
Once you have installed the packages required for your project, you need to turn on Glimpse by going to &lt;code&gt;http://yourproject:port/Glimpse.axd&lt;/code&gt;
&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSMvemmk1p5hRBbrz_nUKhqAMD1e6piRvTe4oajxs0wXhhb3dGUk0lQNZmt6lBGELznRAdquFMPEegmpQEFu7Fzc4K0xx5utlVdEN7nro7sKOWLjvOc0IlV6SyQ6_syK4s3fjOGK9Dax1J/s1600/glimpse_settings.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSMvemmk1p5hRBbrz_nUKhqAMD1e6piRvTe4oajxs0wXhhb3dGUk0lQNZmt6lBGELznRAdquFMPEegmpQEFu7Fzc4K0xx5utlVdEN7nro7sKOWLjvOc0IlV6SyQ6_syK4s3fjOGK9Dax1J/s640/glimpse_settings.png&quot; /&gt;&lt;/a&gt;
&lt;p&gt;
Now you can see stats from Glimpse hud in the bottom right corner of your application.
&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFQpMAtuVDmmzGMjwdzTm0wGRjHkoFObsXwhr_3gtPLMD9Jsj9twti3aFRHz-adYwFmjDB0secECTwA2pOCcUpklU26bklgH5Gqek7j_49JBqxZdeddZOmm0H1WFVNy9K9_-J6OI1MEUkI/s1600/glimpse_hud.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFQpMAtuVDmmzGMjwdzTm0wGRjHkoFObsXwhr_3gtPLMD9Jsj9twti3aFRHz-adYwFmjDB0secECTwA2pOCcUpklU26bklgH5Gqek7j_49JBqxZdeddZOmm0H1WFVNy9K9_-J6OI1MEUkI/s640/glimpse_hud.png&quot; /&gt;&lt;/a&gt;
&lt;p&gt;
You basically turn Glimpse on and off with cookies, it does not run in background. You can setup security policy to control when you want to use it. For example, locally when debugging or with a specific cookie value, or your authorization role, or parent switch in the web.config. 
&lt;/p&gt;

&lt;p&gt;
The Glimpse view is inspired from developer tools like fire bug. The great thing about it is that each tab is a plugin itself and is all built with CSS and javascript.
&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD2uMwuT4hTo8FQDUUMrHrteMhhpmOPDvENsByfFtK3dDfGvHV0xrtWrCyN4Lbv7E3xZm5fxAiVHXMsdASXO4DPEoMGsSxazBpvxWkHmZkmze1rDDvOVp0MswjuZGn7M1jzVTPEXItfkhI/s1600/glimpse_window.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD2uMwuT4hTo8FQDUUMrHrteMhhpmOPDvENsByfFtK3dDfGvHV0xrtWrCyN4Lbv7E3xZm5fxAiVHXMsdASXO4DPEoMGsSxazBpvxWkHmZkmze1rDDvOVp0MswjuZGn7M1jzVTPEXItfkhI/s640/glimpse_window.png&quot; /&gt;&lt;/a&gt;
&lt;p&gt;
You can see all the information from your Configuration file like your connection strings. Information on what environment the application is running on. Even SQL queries being run by entity framework and the time taken for them to complete.
&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOI3kVLmltTw5QdOW8VbIBqhtQyXUOdiNag5w4Wnr2K7Olxlp-bLc_RzfXqgQWyM2Tydv5IvYsJhhgJ43yh6jjxc0S4nMWg7irb0NyGqI2zefLxgflPqKMa9yNxc0eXGx_6klRGSVpSsxE/s1600/glimpse_sql.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOI3kVLmltTw5QdOW8VbIBqhtQyXUOdiNag5w4Wnr2K7Olxlp-bLc_RzfXqgQWyM2Tydv5IvYsJhhgJ43yh6jjxc0S4nMWg7irb0NyGqI2zefLxgflPqKMa9yNxc0eXGx_6klRGSVpSsxE/s640/glimpse_sql.png&quot; /&gt;&lt;/a&gt;
&lt;p&gt;
Since the server is collecting information on all sessions, you can pull out a popup browser window of Glimpse and connect to sessions from other browsers. For example, you could debug a session for a customer remotely whilst they are performing actions.
&lt;/p&gt;
&lt;p&gt;I think it is a great tool which should be used in every ASP.NET project. You should watch this great introduction video on &lt;a href=&quot;http://getglimpse.com/&quot;&gt;Glimpse site&lt;/a&gt; by Anthony and Nick.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/1012369647533040738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2013/09/glimpse-aspnet-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/1012369647533040738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/1012369647533040738'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2013/09/glimpse-aspnet-debugging.html' title='Glimpse - ASP.NET Debugging'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9iQ7ABoSyUFI-48yq0FtnOpTl8smcdXxnKN6QJWCfVqPaG_ty1x0C411HBATadwAGzVbNcaH6sF8zWYbAo_3ktqmNTltJW-H-ey0KihPIML2Fh0lP8dGA0_cOIrG2FsBX0kC0VHlFzmr3/s72-c/glimpse_nuget.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-4076845864155568485</id><published>2013-08-25T22:10:00.000+10:00</published><updated>2013-08-25T22:10:10.479+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="command query separation"/><category scheme="http://www.blogger.com/atom/ns#" term="CQS"/><category scheme="http://www.blogger.com/atom/ns#" term="design principle"/><title type='text'>Command Query Separation</title><content type='html'>&#39;Command Query Separation&#39; (CQS) is a design principle by which the methods of an object are categorised separately:
&lt;p&gt;
&lt;Strong&gt;
Commands:&lt;/Strong&gt;
Changes the state of the system and does not return value.
&lt;pre class=&quot;brush: csharp&quot;&gt;
Public Course Courses.Find(courseName)
{
//implementation
};
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;Strong&gt;
Query:&lt;/Strong&gt;
Returns a result without having any side effects on the state (i.e. does not alter the observable state of the system).
&lt;pre class=&quot;brush: csharp&quot;&gt;
public void Course.AllocateFaculty(faculty)
{
//implementation
};
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
Whilst CQS is a sound principle, but there are exceptions in many cases. Some these violations may be acceptable but other could be potentially dangerous. 
&lt;/p&gt;
&lt;p&gt;
Lets consider an example where this violation maybe acceptable. The classic violation is &lt;code&gt;Stack.Pop()&lt;/code&gt; which is a command and a query. It removes and returns the object at the top of the stack. Another simple example which breaks the pattern but may be useful in multi-threaded programs:
&lt;pre class=&quot;brush: csharp&quot;&gt;
public int IncrementCount()
{
  int copyOfCount;
  lock(_count)
  {
    _count++;
    copyOfCount = _count;
  }
  return copyOfCount;
}
&lt;/pre&gt;
You can manage this better making sure that if a command returns a value, it will go through an out parameter and the command will have a meaningful name &lt;code&gt;IncrementAndReturnCount&lt;/code&gt;.
&lt;pre class=&quot;brush: csharp&quot;&gt;
public void IncrementAndReturnCount(out int latestCount)
{
  lock(_count)
  {
    _count++;
    latestCount = _count;
  }
}
&lt;/pre&gt;
There are however instances where CQS violations cause dangerous side effects that can be difficult to debug. Consider the following method in the &lt;code&gt;Course&lt;/code&gt; class:
&lt;pre class=&quot;brush: csharp&quot;&gt;
public void GetSchedule()
{
  if(this.Schedule==null)
    this.Schedule = new Schedule();
  return this.Schedule;
}
&lt;/pre&gt;
It may seem very harmless that the method instantiates the schedule if it is null. But imagine someone added a new operation to send an alert all the allocated faculties of courses which do not have a schedule set.
&lt;pre class=&quot;brush: csharp&quot;&gt;
foreach(var course in Courses)
{
  if(course.GetSchedule() == null)
    SendAlertToFaculties(course.AllocatedFaculties);
}
&lt;/pre&gt;
By adding command behavior to &lt;code&gt;GetSchedule()&lt;/code&gt;, we have accidentally broken the code. Now we must spend time to re-factor the original code.
&lt;/p&gt;
&lt;p&gt;
We can say CQS is clearly intended as a programming guideline rather than a rule for good coding.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/4076845864155568485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2013/08/command-query-separation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4076845864155568485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4076845864155568485'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2013/08/command-query-separation.html' title='Command Query Separation'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-8707549866446024447</id><published>2013-08-19T01:56:00.001+10:00</published><updated>2013-08-19T01:56:22.468+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="css"/><category scheme="http://www.blogger.com/atom/ns#" term="css framework"/><category scheme="http://www.blogger.com/atom/ns#" term="css media queries"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile friendly"/><category scheme="http://www.blogger.com/atom/ns#" term="viewport"/><title type='text'>Make your web site mobile friendly</title><content type='html'>Last year on an average &lt;a href=&quot;http://www.marketwatch.com/story/new-report-finds-that-local-search-via-mobile-devices-and-tablets-more-than-quadruples-in-2012-2013-05-02&quot;&gt;15% of traffic&lt;/a&gt; to sites was from mobile devices and this will continue to grow.

&lt;div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn5pdUB_sNUgOwgbW578OIyKugMh-CH9dL_il59yfSA4LbHzkyD0R34RQM80vjTXXO3dsKRaKYiKkAhvdiSufv7PZNITKixPw558w9nnglHkxGDK6KYrhSsl8lOpYQ7BPFm840vt9QsRjM/s1600/website-traffic-by-device.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn5pdUB_sNUgOwgbW578OIyKugMh-CH9dL_il59yfSA4LbHzkyD0R34RQM80vjTXXO3dsKRaKYiKkAhvdiSufv7PZNITKixPw558w9nnglHkxGDK6KYrhSsl8lOpYQ7BPFm840vt9QsRjM/s1600/website-traffic-by-device.jpg&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;p/&gt;
There are many solutions to optimize your site for mobile devices. For example adaptive design, responsive design, website conversion. Each has pros and cons, and ranges from free to thousands of dollars. The amount you spend depends on the requirements of your business and your visitors. We will walk through things you can do in context of responsive design to make your site mobile friendly.
&lt;/p&gt;
&lt;h3&gt;Mobile meta tags&lt;/h3&gt;
&lt;/p&gt;
We can improve users browsing experience on certain devices by using the mobile webkit.
&lt;/p&gt;
&lt;h4&gt;Viewport&lt;/h4&gt;
&lt;p&gt;
This meta tag tells the browser how content should fit on the device&#39;s screen.
&lt;pre class=&quot;brush: xml&quot;&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, 
 user-scalable=yes&quot;&gt;
&lt;/pre&gt;
The above example tells the browser to set the viewport to the width of the device with initial scale of 1.0. We can turn off zooming by setting &lt;mark&gt;user-scalable=no&lt;/mark&gt; or can limit the scaling level.
&lt;pre class=&quot;brush: xml&quot;&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, 
 minimum-scale=0.5, maximum-scale=1.0&quot;&gt;
&lt;/pre&gt;
You can also set the width to a pixel value (e.g. 320px) but note not all devices have same width so it&#39;s better to stick with device-width and let browser take care of the rest.
&lt;/p&gt;
&lt;p&gt;
You can look into some device specific settings on &lt;a href=&quot;http://developer.android.com/reference/android/webkit/WebView.html&quot;&gt;Android&lt;/a&gt; and &lt;a href=&quot;http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html&quot;&gt;iOS&lt;/a&gt; to further improve user&#39;s experience.
&lt;/p&gt;
&lt;h4&gt;Home Screen Icons&lt;/h4&gt;
&lt;p&gt;
iOS and Android devices also accept a &lt;mark&gt;rel=&quot;apple-touch-icon&quot;&lt;/mark&gt; (iOS) and &lt;mark&gt;rel=&quot;apple-touch-icon-precomposed&quot;&lt;/mark&gt; (Android) for links. They get used as icon on the user&#39;s home screen when they bookmark your site.
&lt;pre class=&quot;brush: xml&quot;&gt;
&lt;link rel=&quot;apple-touch-icon&quot;
      href=&quot;/images/icon.png&quot; /&gt;
&lt;link rel=&quot;apple-touch-icon-precomposed&quot;
      href=&quot;/images/icon.png&quot; /&gt;
&lt;/pre&gt;
&lt;/p&gt;
&lt;h3&gt;CSS3 Media Queries&lt;/h3&gt;
&lt;p&gt;
Media queries enables the content&#39;s presentation to be customized to a specific range of output devices without having to change the content itself. 
&lt;/p&gt;
&lt;h4&gt;Screen Sizes&lt;/h4&gt;
&lt;p&gt;
The example below shows how we can target mobile devices
&lt;pre class=&quot;brush: xml&quot;&gt;
&lt;link rel=&quot;stylesheet&quot; media=&quot;only screen and (max-device-width: 320px)&quot; 
 href=&quot;mobile.css&quot;&gt;
&lt;/pre&gt;
A media query with the &quot;only&quot; keyword will cause non CSS3-compliant browsers to ignore it.

The following example would target tablet screen sizes.
&lt;pre class=&quot;brush: xml&quot;&gt;
&lt;link rel=&quot;stylesheet&quot; media=&quot;only screen and (min-width: 641px) and (max-width: 800px)&quot; 
 href=&quot;ipad.css&quot;&gt;
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
Some of the styling changes that you should enforce:
&lt;ul&gt;
&lt;li&gt;Reduce extra whitespace/padding across the site. Space is premium!&lt;/li&gt;
&lt;li&gt;Remove :hover states. They&#39;ll never been seen on touch devices.&lt;/li&gt;
&lt;li&gt;Adjust the layout to be single column.&lt;/li&gt;
&lt;li&gt;Remove the box-shadow around big container div. Large box shadows reduce page performance.&lt;/li&gt;
&lt;li&gt;Remove opacity changes. Changing alpha values is a performance hit on mobile.&lt;/li&gt;
&lt;/ul&gt;

You can read more about media queries &lt;a href=&quot;http://www.w3.org/TR/css3-mediaqueries/&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;CSS Frameworks&lt;/h3&gt;
&lt;p&gt;
In context of responsive design CSS frameworks have many benefits. A well-built CSS framework or boilerplate can streamline the design process, save huge chunks of development time and ensure your website scales properly on all devices.

Here are few you can look into:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.github.com/bootstrap/index.html&quot;&gt;Bootstrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://lessframework.com/&quot;&gt;Less Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.getskeleton.com/&quot;&gt;Skeleton&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://foundation.zurb.com/&quot;&gt;Foundation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://gumbyframework.com/&quot;&gt;Gumby Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://matthewhartman.github.com/base/&quot;&gt;Base&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/8707549866446024447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2013/08/make-your-web-site-mobile-friendly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/8707549866446024447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/8707549866446024447'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2013/08/make-your-web-site-mobile-friendly.html' title='Make your web site mobile friendly'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn5pdUB_sNUgOwgbW578OIyKugMh-CH9dL_il59yfSA4LbHzkyD0R34RQM80vjTXXO3dsKRaKYiKkAhvdiSufv7PZNITKixPw558w9nnglHkxGDK6KYrhSsl8lOpYQ7BPFm840vt9QsRjM/s72-c/website-traffic-by-device.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-4582572742709713986</id><published>2011-03-12T13:33:00.000+11:00</published><updated>2011-03-12T13:33:27.785+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application library caching"/><category scheme="http://www.blogger.com/atom/ns#" term="decrease size"/><category scheme="http://www.blogger.com/atom/ns#" term="reduce size"/><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight"/><category scheme="http://www.blogger.com/atom/ns#" term="XAP file"/><title type='text'>Silverlight: Manage XAP Files</title><content type='html'>The XAP file size for Silverlight projects can become quite large if they are not managed properly. This will cause the initial loading time to increase and slow performance of your application. &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Manage common assemblies&lt;/h3&gt;To address the duplication of shared assemblies in multiple XAP files, we have couple of options.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;The first is to reference all the shared assemblies in the shell application XAP file. Then we can go to the reference of these shared assemblies in each of the modules and set the &lt;b&gt;Copy Local&lt;/b&gt; property on the reference to false. This causes the referenced shared assemblies to not be included in the compiled XAP file for that module. However, at runtime, the one provided by the shell application XAP file will also be available to the modules.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Advantages: &lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;All the common assemblies are downloaded once.&lt;/li&gt;
&lt;li&gt;XAP file size for other modules decreases.&lt;/li&gt;
&lt;li&gt;Subsequent requests are faster.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;b&gt;Disadvantages:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The initial download size will be large.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;

&lt;li&gt;The second approach is to use application library caching in Silverlight. To use this feature, we need to go to the properties of all the Silverlight projects and select the check box labeled Reduce XAP size by using application library caching. When we do this, any referenced assemblies that have the right metadata files collocated with them will not be included in the XAP file. Instead, they will be placed in a separate .zip file, and the .zip file will be referenced by the XAP file’s ApplicationManifest.xaml file as an external part. These files are added to the browser cache so that they can be reused on subsequent visits. All downloaded files are subject to the caching configuration settings on the server and in the browser. In a typical configuration, files are downloaded only if they are not in the cache or if they are newer than the cached versions. Libraries from Prism, Silverlight SDK and Toolkit have the required metadata files to use this feature. &lt;br /&gt;
&lt;br /&gt;
If you want to leverage of the functionality for our assemblies, we need to provide the proper metadata files. More about this has been discussed in the following article: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd833069(VS.95).aspx&quot;&gt;How to: Use Application Library Caching&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You can test this option with your application using Fiddler, and see that shared assemblies are only downloaded when they are required and are not downloaded on subsequent requests.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Advantages: &lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;XAP file size of all the module decreases.&lt;/li&gt;
&lt;li&gt;Common assemblies are downloaded separately as they are required.&lt;/li&gt;
&lt;li&gt;Downloaded common assemblies are cached and available to all modules until new versions are provided. (subject to the caching configuration settings on the server and in the client browser)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;b&gt;Disadvantages:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;We cannot use application library caching and out-of-browser support in the same application. Out-of-browser applications require all startup assemblies to reside in the application package.&lt;/li&gt;
&lt;li&gt;We need to ensure the clients are not using old cached assemblies when new versions of the common assemblies are deployed.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;h3&gt;Improve XAP file compression&lt;/h3&gt;XAP files are basically just standard ZIP files with different extension, so we can use compression tools (like Winrar) to decrease the file size even more by using the best compression algorithm. &lt;br /&gt;
&lt;br /&gt;
We can create batch file that can be added to all the Silverlight projects to automatically re-compress the project’s XAP file more efficiently. And we can do this easily by adding command in the project’s post-build events. Around 5% to 20% reduction can be achieved depending on the contents of the XAP file.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/4582572742709713986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2011/03/silverlight-manage-xap-files.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4582572742709713986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4582572742709713986'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2011/03/silverlight-manage-xap-files.html' title='Silverlight: Manage XAP Files'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-1698376452097368481</id><published>2011-01-16T11:02:00.000+11:00</published><updated>2011-01-16T11:02:17.692+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Repository Pattern"/><title type='text'>The Repository Pattern - Entity Framework</title><content type='html'>&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;
In many applications, business logic accesses data from data stores. There are lot of potential issues when accessing them directly, for example:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Code duplication&lt;/li&gt;
&lt;li&gt;Higher chances of programming errors&lt;/li&gt;
&lt;li&gt;Problems in testing business logic in isolation from external dependencies&lt;/li&gt;
&lt;li&gt;Difficulty in implementing centrally managed consistent rules and logic&lt;/li&gt;
&lt;/ul&gt;So it is a good idea to build a layer of abstraction which mediates between the business layer and data source layer of the application. This is where repository pattern comes in to achieve our objectives.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is Repository&lt;/b&gt;&lt;br /&gt;
As described on&lt;a href=&quot;http://martinfowler.com/eaaCatalog/repository.html&quot;&gt; Martin Flower&#39;s&lt;/a&gt; website:&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&lt;i&gt;&quot;A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection. Client objects construct query specifications declaratively and submit them to Repository for satisfaction. Objects can be added to and removed from the Repository, as they can from a simple collection of objects, and the mapping code encapsulated by the Repository will carry out the appropriate operations behind the scenes. Conceptually, a Repository encapsulates the set of objects persisted in a data store and the operations performed over them, providing a more object-oriented view of the persistence layer. Repository also supports the objective of achieving a clean separation and one-way dependency between the domain and data mapping layers.&quot;&lt;/i&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://i.msdn.microsoft.com/dynimg/IC340233.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC340233.png&quot; width=&quot;543&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;br /&gt;
We will discuss the implementation of repositories in context of &lt;a href=&quot;http://domaindrivendesign.org/&quot;&gt;DDD&lt;/a&gt;(domain driven  design) for entity framework. Using generics we will create a base repository which will have all the common functionality. And then we will inherit from the base repository to create model/domain specific repositories.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Repository Interface&lt;/b&gt;&lt;br /&gt;
This is how the repository interface will look like. &lt;i&gt;IRepository&amp;lt;T&amp;gt;&lt;/i&gt; is the contract where T is a POCO class. For testing we can later write an fake implementation to remove the dependency.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IRepository&lt;/span&gt;&amp;lt;T&amp;gt; &lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt; T : &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;IQueryable&lt;/span&gt;&amp;lt;T&amp;gt; GetQuery();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;T&amp;gt; GetAll();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;T&amp;gt; Find(&lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T, &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; where);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T Single(&lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T, &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; where);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T First(&lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T, &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; where);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Delete(T entity);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Add(T entity);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Attach(T entity);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; SaveChanges();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Generic Repository Implementation&lt;/b&gt;&lt;br /&gt;
The base repository takes an &lt;i&gt;IObjectContext&lt;/i&gt; as a constructor argument for dependency injection.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;EFRepositoryBase&lt;/span&gt;&amp;lt;T&amp;gt; : &lt;span style=&quot;color: #2b91af;&quot;&gt;IRepository&lt;/span&gt;&amp;lt;T&amp;gt; &lt;span style=&quot;color: blue;&quot;&gt;where&lt;/span&gt; T : &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;readonly&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IObjectContext&lt;/span&gt; _objectContext;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;readonly&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IObjectSet&lt;/span&gt;&amp;lt;T&amp;gt; _objectSet;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; EFRepositoryBase(&lt;span style=&quot;color: #2b91af;&quot;&gt;IObjectContext&lt;/span&gt; objectContext)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _objectContext = objectContext;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _objectSet = _objectContext.CreateObjectSet&amp;lt;T&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IQueryable&lt;/span&gt;&amp;lt;T&amp;gt; GetQuery()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; _objectSet;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;T&amp;gt; GetAll()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; GetQuery().ToList();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;T&amp;gt; Find(&lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T, &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; where)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; _objectSet.Where(where);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; T Single(&lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T, &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; where)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; _objectSet.Single(where);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; T First(&lt;span style=&quot;color: #2b91af;&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T, &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; where)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; _objectSet.First(where);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Delete(T entity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _objectSet.DeleteObject(entity);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Add(T entity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _objectSet.AddObject(entity);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Attach(T entity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _objectSet.Attach(entity);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; SaveChanges()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _objectContext.SaveChanges();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Domain specific repository&lt;/b&gt;&lt;br /&gt;
In these derived repositories you can add the domain/model specific query operations. Here is how the interface and implementation of a User model repository will look like.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IUserRepository&lt;/span&gt; : &lt;span style=&quot;color: #2b91af;&quot;&gt;IRepository&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;User&lt;/span&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//add user specific operations&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;EFUserRepository&lt;/span&gt; : &lt;span style=&quot;color: #2b91af;&quot;&gt;EFRepositoryBase&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;User&lt;/span&gt;&amp;gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;IUserRepository&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; EFUserRepository(&lt;span style=&quot;color: #2b91af;&quot;&gt;IObjectContext&lt;/span&gt; objectContext)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;: &lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;(objectContext)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//add user specific operations&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/1698376452097368481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2011/01/repository-pattern-entity-framework.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/1698376452097368481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/1698376452097368481'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2011/01/repository-pattern-entity-framework.html' title='The Repository Pattern - Entity Framework'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-907442148648517189</id><published>2010-11-29T13:07:00.001+11:00</published><updated>2010-11-30T08:59:29.697+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Light Switch"/><title type='text'>Microsoft Light Switch</title><content type='html'>Microsoft has come out with a rapid-application development tool to build applications for the desktop, the web, and the cloud. Microsoft is promoting &lt;i&gt;LightSwitch&lt;/i&gt;&amp;nbsp;as the simplest way for developers of all skill levels to develop business applications, but it seems to be targeted more at inexperienced developers.&lt;br /&gt;
&lt;br /&gt;
You can download the beta version and look at some demonstration videos &lt;a href=&quot;http://www.microsoft.com/visualstudio/en-us/lightswitch&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/907442148648517189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/microsoft-light-switch.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/907442148648517189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/907442148648517189'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/microsoft-light-switch.html' title='Microsoft Light Switch'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-277311590698102543</id><published>2010-11-28T17:55:00.002+11:00</published><updated>2010-11-28T17:58:25.944+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OData"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF Data Services"/><title type='text'>WCF Data Services</title><content type='html'>It often becomes difficult (if not painful) to share data beyond its original intent. As systems continue to become more interconnected, the need to reuse information also grows and the value of any given data becomes greater the more it can be shared and accessed by other systems.&lt;br /&gt;
&lt;br /&gt;
The &lt;a href=&quot;http://www.odata.org/&quot;&gt;Open Data Protocol&lt;/a&gt;, referred to as &lt;b&gt;OData&lt;/b&gt;, is a new data-sharing standard that breaks down silos and fosters an interoperative ecosystem for data consumers (clients) and producers (services) that is far more powerful than currently possible. WCF Data Services, is the Microsoft technology to support the Open Data Protocol. Microsoft now also supports OData in SQL Server 2008 R2, Windows Azure Storage, Excel 2010 (through PowerPivot), and SharePoint 2010.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://i.msdn.microsoft.com/dynimg/IC392644.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC392644.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
In addition to client libraries that simplify working with OData, the Data Services framework builds on the general WCF capabilities to provide a solution for creating OData services for the web. Data Services enable you to expose data models to the Web in a RESTful way, with rich built-in data access capabilities such as flexible querying, paging, and association traversal.&lt;br /&gt;
&lt;br /&gt;
The Data Services framework facilitates the creation of flexible data services that are naturally integrated with the web. WCF Data Services use URIs to point to pieces of data and use simple, well-known formats to represent that data, such as JSON and ATOM (XML-based feed format). This results in the data service being surfaced as a REST-style resource collection that is addressable with URIs and with which agents can interact using standard HTTP verbs such as GET, POST, PUT or DELETE.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;For examples and quick start guides on WCF Data Services, go to this &lt;a href=&quot;http://msdn.microsoft.com/en-us/data/odata.aspx&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;link&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;. Also, read more about OData protocol &lt;a href=&quot;http://www.odata.org/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/277311590698102543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/wcf-data-services_28.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/277311590698102543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/277311590698102543'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/wcf-data-services_28.html' title='WCF Data Services'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-3650181045312562291</id><published>2010-11-25T17:06:00.004+11:00</published><updated>2010-11-26T00:06:12.286+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DataContractSerializer"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><category scheme="http://www.blogger.com/atom/ns#" term="XmlSerializer"/><title type='text'>Difference between XmlSerializer and DataContractSerializer (WCF)</title><content type='html'>&lt;b&gt;Lets start with, what is serialization?&lt;/b&gt;&lt;br /&gt;
It is the process of converting an object instance into a format that can be persisted and formated. The objects can be serialized into all sorts of formats(Xml, binary, json, etc).  Serializing to Xml is most often used for its interoperability. Serializing to binary is useful when you want to send the object from one .Net application to another. .Net even supports the interfaces and base classes to build your own serialization format.&lt;br /&gt;
&lt;br /&gt;
Deserialization is basically the reverse of serialization.  Its the process of taking some data (Xml, binary, json, etc) and converting it back into an object.&lt;br /&gt;
&lt;br /&gt;
I want to point out, that the differences between &lt;i&gt;XmlSerializer&lt;/i&gt; and &lt;i&gt;DataContractSerializer&lt;/i&gt; are in context of WCF.&lt;br /&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt;&lt;td style=&quot;width: 50%;&quot;&gt;&lt;div style=&quot;color: #3d85c6; font-weight: bold;&quot;&gt;XmlSerializer&lt;/div&gt;&lt;div style=&quot;font-size: 13px; font-weight: bold;&quot;&gt;Advantages:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Opt-out rather than opt-in properties to serialize. This mean you don’t have to specify each and every property to serialize, only those you don’t want to serialize&lt;/li&gt;
&lt;li&gt;Full control over how a property is serialized including it being a node or an attribute&lt;/li&gt;
&lt;li&gt;Supports more of the XSD standard&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;font-size: 13px; font-weight: bold;&quot;&gt;Disadvantages:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Can only serialize properties&lt;/li&gt;
&lt;li&gt;Properties must be public&lt;/li&gt;
&lt;li&gt;Properties must have a get and a set which can result in some awkward design&lt;/li&gt;
&lt;li&gt;Supports a narrower set of types&lt;/li&gt;
&lt;li&gt;Cannot understand the DataContractAttribute and will not serialize it unless there is a SerializableAttribute too&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;   &lt;td style=&quot;width: 50%;&quot;&gt;&lt;div style=&quot;color: #3d85c6; font-weight: bold;&quot;&gt;DataContractSerializer&lt;/div&gt;&lt;div style=&quot;font-size: 13px; font-weight: bold;&quot;&gt;Advantages:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Opt-in rather than opt-out properties to serialize. This means, you specify what you want to serialize&lt;/li&gt;
&lt;li&gt;Because it is opt in model, you can serialize not only properties, but also fields.  You can even serialize non-public members. And you don&#39;t need a set on a property either (however without a setter you can serialize, but not deserialize)&lt;/li&gt;
&lt;li&gt;Is faster than XmlSerializer because you don’t have full control over how it is serialized, there is a lot that can be done to optimize the serialization/deserialization process.&lt;/li&gt;
&lt;li&gt;Can understand the SerializableAttribute and know that it needs to be serialized&lt;/li&gt;
&lt;li&gt;More options and control over KnownTypes&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;font-size: 13px; font-weight: bold;&quot;&gt;Disadvantages:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;No control over how the object is serialized outside of setting the name and the order&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
For WCF, prefer to use the DataContractSerializer. But if you need full control over how the xml looks, use XmlSerializer.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/3650181045312562291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/difference-between-xmlserializer-and.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3650181045312562291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3650181045312562291'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/difference-between-xmlserializer-and.html' title='Difference between XmlSerializer and DataContractSerializer (WCF)'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-4599124183514309203</id><published>2010-11-19T21:55:00.000+11:00</published><updated>2010-11-19T21:55:25.834+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="life cycle"/><category scheme="http://www.blogger.com/atom/ns#" term="page life cycle"/><title type='text'>ASP.NET Page Life Cycle Overview</title><content type='html'>It is important to understand how ASP.NET page life cycle works, as it provides insight about the series of processing steps it goes through and then you can write code at the appropriate life-cycle stage. Specially when you are developing custom controls, you need to be familiar with the page life cycle in order to correctly initialize controls, populate control properties with view-state data and run behavior code.&lt;br /&gt;
&lt;br /&gt;
I am not going to explain all the stages and events of the page life cycle, as it is well documented on MSDN and other blogs. But I found a really good image which provides you an overview of the page life cycle. The following image shows some of the most important methods of the Page class that you can override in order to add code that executes at specific points in the page life cycle. The image also shows how these methods relate to page events and to control events. The sequence of methods and events in the illustration is from top to bottom, and within each row from left to right.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://i.msdn.microsoft.com/dynimg/IC386473.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC386473.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
This above image is relevant to .NET framework 4.0. I am going to print this out and stick it somewhere near my desk. BTW, an easy way of remember the important page life-cycle stages is &lt;b&gt;SILVER&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
S – Start &lt;br /&gt;
I – Initialize &lt;br /&gt;
L – Load &lt;br /&gt;
V – Validate &lt;br /&gt;
E – Event Handling &lt;br /&gt;
R – Render</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/4599124183514309203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/aspnet-page-life-cycle-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4599124183514309203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4599124183514309203'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/aspnet-page-life-cycle-overview.html' title='ASP.NET Page Life Cycle Overview'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-4247214778850097733</id><published>2010-11-18T14:02:00.000+11:00</published><updated>2010-11-18T14:02:34.943+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="inheritance"/><category scheme="http://www.blogger.com/atom/ns#" term="POCO"/><category scheme="http://www.blogger.com/atom/ns#" term="POCO Entities"/><category scheme="http://www.blogger.com/atom/ns#" term="t4 editor"/><category scheme="http://www.blogger.com/atom/ns#" term="t4 template"/><title type='text'>Update T4 POCO Template for inheritance</title><content type='html'>Lately I have been working on an application which uses Entity Framework 4. After playing around with the default code generation, I found the option of using ADO.NET POCO template generator. They are very light compared to the entities generated by the default code generator.&lt;br /&gt;
&lt;br /&gt;
But I wanted to customize the template further to suit my requirements. One of the requirements was that all the entity classes should inherit from a base class. So to edit the template, first you need to install T4 editor extension (download it from &lt;a href=&quot;http://t4-editor.tangible-engineering.com/T4-Editor-Visual-T4-Editing.html&quot;&gt;here&lt;/a&gt;). &amp;nbsp;This editor provides intelli-sense and syntax-hilighting. &lt;br /&gt;
&lt;br /&gt;
Currently the entities generated from the model inherit from other entities only if that inheritance is defined in the model. For example, Employee inherits from Person. This is how the entity decleration looks in the original template:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;partial&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;&amp;lt;#=code.Escape(entity)#&amp;gt;&amp;lt;#=code.StringBefore(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;&quot;&amp;nbsp;:&amp;nbsp;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;,code.Escape(entity.BaseType))#&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This ensures that the Employee class inherits from Person, or that any derived entity inherits from its base, in the generated code. But we now want to have every entity inherit from the new base class (&lt;i&gt;BaseModel&lt;/i&gt;) unless the entities are already deriving from another base entity. In other words, Person should inherit directly from &lt;i&gt;BaseModel&lt;/i&gt;, while Employee continues to inherit from Person (and therefore indirectly inherits &lt;i&gt;BaseModel&lt;/i&gt;).&lt;br /&gt;
&lt;br /&gt;
First, you’ll need to add the method, BaseTypeName, as shown below. Look for &lt;b&gt;IsReadWriteAccessibleProperty&lt;/b&gt; method and add the following method above it.&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt; BaseTypeName(EntityType entity, CodeGenerationTools code)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt; entity.BaseType == &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt; ? &lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 10pt;&quot;&gt;&quot;Namespace.BusinessEntities.BaseModel&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt; : &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&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;code.Escape(entity.BaseType);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
Now you can modify the code shown before, where the entity declaration is made to call the BaseTypeName method. As  result, the entity will inherit from either &lt;i&gt;BaseModel&lt;/i&gt; or its base type as defined in the model.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;partial&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt; &amp;lt;#=code.Escape(entity)#&amp;gt;&amp;lt;#=code.StringBefore(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;&quot; : &quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;, BaseTypeName(entity, code))#&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
Ensure the entities can locate the &lt;i&gt;BaseModel&lt;/i&gt; class. Once you save the template, the entities should get re-generated again based on our customised template.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/4247214778850097733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/modify-t4-poco-template-for-inheritance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4247214778850097733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4247214778850097733'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/modify-t4-poco-template-for-inheritance.html' title='Update T4 POCO Template for inheritance'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-3753835002314421085</id><published>2010-11-17T13:23:00.001+11:00</published><updated>2010-11-17T15:03:34.699+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="aggregate functions"/><category scheme="http://www.blogger.com/atom/ns#" term="over"/><category scheme="http://www.blogger.com/atom/ns#" term="over clause"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><category scheme="http://www.blogger.com/atom/ns#" term="t-sql"/><title type='text'>SQL OVER Clause with aggregate functions</title><content type='html'>In one of my previous post, we saw the usage of OVER() clause for ranking functions. We can also use the OVER() Clause to simplify aggregate calculations. We can now add aggregate functions to any SELECT (even without a GROUP BY clause) by specifying an OVER() partition for each function. Consider the following table:&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-left: 5.15pt; width: 629px;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;StudentID&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Quesiton Reference No&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Section&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Required Score&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 1;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-M100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 2;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-M200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;15&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 3;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-M300&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 4;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-M400&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 5;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-P100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Physics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 6;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-P200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Physics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;30&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 7;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-P300&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Physics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 8;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-C100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Chemistry&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;50&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 9;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-C200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Chemistry&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 10; mso-yfti-lastrow: yes;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 137.4pt;&quot; valign=&quot;bottom&quot; width=&quot;183&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 131.4pt;&quot; valign=&quot;bottom&quot; width=&quot;175&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Q-C300&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 116.4pt;&quot; valign=&quot;bottom&quot; width=&quot;155&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Chemistry&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 86.4pt;&quot; valign=&quot;bottom&quot; width=&quot;115&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
Say, there is a requirement where you want to find the weightage of each question within a section&lt;br /&gt;
and also the wieghtage of each section for a student. Normally, you would create sub-queries to retrieve the summary values for calculations, as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&amp;nbsp;[StudentID],&amp;nbsp;[Quesiton Reference No]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; [Section]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; [Required Score]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;(((&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;1.0&lt;span style=&quot;color: grey;&quot;&gt;)/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;nbsp;&amp;nbsp;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;A&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; Answers A&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; A&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Section] &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; Answers&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Section]&lt;span style=&quot;color: grey;&quot;&gt;))*&lt;/span&gt;100&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; QuestionWeightageInSection&lt;span style=&quot;color: grey;&quot;&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;((((&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;A&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; Answers A &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; A&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Section] &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; Answers&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Section]&lt;span style=&quot;color: grey;&quot;&gt;)*&lt;/span&gt;1.0&lt;span style=&quot;color: grey;&quot;&gt;)/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;A&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; Answers A&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 8pt; line-height: 115%;&quot;&gt;WHERE &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt; line-height: 115%;&quot;&gt;A.[StudentID] = 1&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;))*&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px;&quot;&gt; SectionWeightage&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 8pt; line-height: 115%;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt; line-height: 115%;&quot;&gt; Answers&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;Answers&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;[StudentID]&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: 11px; line-height: 12px;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
But now with OVER() Clause this becomes more simple and efficient. This is how the query will look:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt; [StudentID]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; [Quesiton Reference No]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; [Section]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; [Required Score]&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;(((&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;1.0&lt;span style=&quot;color: grey;&quot;&gt;)/(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; [Section]&lt;span style=&quot;color: grey;&quot;&gt;)))*&lt;/span&gt;100&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; QuestionWeightageInSection&lt;span style=&quot;color: grey;&quot;&gt;,&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;((((&lt;/span&gt;&lt;span style=&quot;color: magenta; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; [Section]&lt;span style=&quot;color: grey;&quot;&gt;))*&lt;/span&gt;1.0&lt;span style=&quot;color: grey;&quot;&gt;)/(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;[Required Score]&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; [StudentID]&lt;span style=&quot;color: grey;&quot;&gt;)))*&lt;/span&gt;100&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; SectionWeightage&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 8pt; line-height: 115%;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 8pt; line-height: 115%;&quot;&gt; Answers &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; Answers&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;[StudentID] &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 593px;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;StudentID&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Quesiton Reference   No&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Section&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Required Score&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Question Weightage In   Section&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;background: black; border-left: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Section Weightage&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 1;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-C100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Chemistry&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;50&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;66.66666667&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;41.66666667&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 2;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-C200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Chemistry&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;13.33333333&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;41.66666667&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 3;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-C300&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Chemistry&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;15&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;41.66666667&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 4;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-M400&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;18.18181818&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;30.55555556&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 5;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-M100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;18.18181818&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;30.55555556&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 6;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-M300&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;36.36363636&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;30.55555556&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 7;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-M200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Maths&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;15&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;27.27272727&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;30.55555556&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 8;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-P100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Physics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;27.77777778&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 9;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-P200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Physics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;30&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;60&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;27.77777778&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 10; mso-yfti-lastrow: yes;&quot;&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid black 1.0pt; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 56.95pt;&quot; valign=&quot;bottom&quot; width=&quot;76&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Q-P300&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 3.0cm;&quot; valign=&quot;bottom&quot; width=&quot;113&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;Physics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.2pt;&quot; valign=&quot;bottom&quot; width=&quot;120&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; height: 12.75pt; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 63.8pt;&quot; valign=&quot;bottom&quot; width=&quot;85&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;&quot;&gt;&lt;span style=&quot;color: black; font-family: Arial, sans-serif; font-size: 8pt;&quot;&gt;27.77777778&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
The way it works is similar to joining an aggregated copy of a SELECT to itself. In my experience it is 20% or more faster than co-related sub queries. You can always look up the execution plan to see the differences between performance. You can use the OVER() Clause with all the other aggregate functions similarly. Read more about it &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms189461.aspx&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/3753835002314421085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/sql-over-clause-with-aggregate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3753835002314421085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3753835002314421085'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/sql-over-clause-with-aggregate.html' title='SQL OVER Clause with aggregate functions'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-6503080425847162754</id><published>2010-11-14T22:49:00.003+11:00</published><updated>2010-12-17T08:19:10.097+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF services"/><title type='text'>Entity Framework 4 and WCF Services</title><content type='html'>Recently I have been reading about using entity framework 4 with WCF services. There are array of options for building services, each option servers a different purpose. As I have played around with various options, I want to talk about which solution(s) applies to different requirements.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt;POCO entities or EntityObects?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
EntityObjects are the “out of the box” option, while&amp;nbsp;they provide a lot of useful automated change tracking and relationship management, it is challenging to work with services that depend on EntityObjects and&amp;nbsp;transfer them across&amp;nbsp;tiers. POCO(Plain Old CLR Objects) entities remove lot of extra layers concerning state management, when you are creating services&amp;nbsp;and making them easy for end users to consume.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt;Custom service, data service, or RIA service?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
There are three paths to choose for WCF services.&amp;nbsp;The first is to write your own service. This is where you have full control over&amp;nbsp;the service operations and the other logic, including handling&amp;nbsp;features such as security.&lt;br /&gt;
&lt;br /&gt;
WCF Data Services is a more lightweight solution and allows you to provide your&amp;nbsp;data to a wide range of consumers. Unlike WCF services, which use SOAP to move&amp;nbsp;data across the wire, WCF Data Services exposes your data for access through URIs&amp;nbsp;over REST (i.e., directly through HTTP). There are also convenient client APIs&amp;nbsp;for .NET, Silverlight, PHP, AJAX, and other consumers. This approach might appear as putting your database on the Internet, which is not the case. What is exposed&amp;nbsp;is first defined by your model and further refined by settings in your service. You&amp;nbsp;do have some control over securing the data, but it is not the same control you can&amp;nbsp;exercise with your custom services.&lt;br /&gt;
&lt;br /&gt;
WCF RIA Services attempts to bridge the gap between custom services and&amp;nbsp;WCF Data Services. WCF RIA Services was originally designed to&amp;nbsp;help getting data into and out of Silverlight applications,&amp;nbsp;you can also consume RIA services from other applications as well, because in the&amp;nbsp;end, unlike WCF Data Services, WCF RIA Services is still a WCF service. RIA&amp;nbsp;services encapsulate some of the most common desired CRUD functionality.Though this does not still give you complete control, but if you want leverage a boxed solution which is customizable, WCF RIA Services could be a good candidate.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #38761d;&quot;&gt;Self-tracking entities?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Self-tracking entities are not lightweight, and to get their true benefits, the consuming application must be a .NET 3.5 or 4 app that contains self-tracking entities. Self-tracking entities is the simplest path for using entities in WCF services. Do not mistake self-tracking entities as a great solution for all of your applications. They are written specifically to be used with custom WCF services. They will not work with WCF Data Services or WCF RIA Services, nor can you use them to solve n-tier issues in other applications.&lt;br /&gt;
&lt;br /&gt;
Self-tracking entities are very different from other POCO classes, whether your POCO classes are generated from the provided template, a customized version of that template, or your own template.&lt;br /&gt;
&lt;br /&gt;
It is very important to understand what different options are available, so we can make the right choice when exposing business model through WCF.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reference&lt;/b&gt;: Programming Entity Framework, Second Edition, by Julia Lerman.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/6503080425847162754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/entity-framework-4-and-wcf-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/6503080425847162754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/6503080425847162754'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/entity-framework-4-and-wcf-services.html' title='Entity Framework 4 and WCF Services'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-6298276107445370113</id><published>2010-11-11T23:50:00.001+11:00</published><updated>2010-11-12T14:52:09.198+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ranking functions"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="t-sql"/><title type='text'>SQL Ranking functions</title><content type='html'>Ranking functions return a ranking value for each rows in your result set. Many tasks, like generating sequential numbers, finding ranks, and so on, which in pre-2005 SQL Server versions requires many lines of code, now can be implemented much easier and faster. &lt;br /&gt;
&lt;br /&gt;
Look at the following example: &lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: sql;&quot;&gt;SELECT FirstName, LastName, PostalCode, 
       ,ROW_NUMBER() OVER (ORDER BY PostalCode) AS &#39;Row Number&#39;
       ,RANK() OVER (ORDER BY PostalCode) AS &#39;Rank&#39;
       ,DENSE_RANK() OVER (ORDER BY PostalCode) AS &#39;Dense Rank&#39;
       ,NTILE(2) OVER (ORDER BY PostalCode) AS &#39;Bi-tile&#39;
FROM   Persons
&lt;/pre&gt;&lt;br /&gt;
Result Set:&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;FirstName&lt;/th&gt;&lt;th&gt;LastName&lt;/th&gt;&lt;th&gt;PostalCode&lt;/th&gt;&lt;th&gt;Row Number&lt;/th&gt;&lt;th&gt;Rank&lt;/th&gt;&lt;th&gt;Dense Rank&lt;/th&gt;&lt;th&gt;Bi-tile&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Joe&lt;/td&gt;&lt;td&gt;Harley&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3007&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;David&lt;/td&gt;&lt;td&gt;Bigel&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3007&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Joel&lt;/td&gt;&lt;td&gt;Friedlaender&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3007&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Kenny&lt;/td&gt;&lt;td&gt;Lam&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3128&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Nirmal&lt;/td&gt;&lt;td&gt;Parrera&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3128&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;5&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Gurnam&lt;/td&gt;&lt;td&gt;Madan&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3128&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;6&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;2&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Troy&lt;/td&gt;&lt;td&gt;Parker&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3150&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;7&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;7&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Melanie&lt;/td&gt;&lt;td&gt;????&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3150&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;8&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;7&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Jeremy&lt;/td&gt;&lt;td&gt;Pickhaver&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3150&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;9&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;7&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;3&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;4&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
Lets look at each of these ranking functions:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. ROW_NUMBER()&lt;/b&gt;&lt;partition_by_clause&gt;&lt;order_by_clause&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Segoe UI&#39;, Verdana, Arial; font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;/order_by_clause&gt;&lt;/partition_by_clause&gt;&lt;br /&gt;
&lt;pre style=&quot;font-family: Consolas, Courier, monospace; font-style: normal; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;&quot;&gt;ROW_NUMBER () &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OVER ( [ &amp;lt;partition_by_clause&amp;gt; ] &amp;lt;order_by_clause&amp;gt; )&lt;/pre&gt;This function returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition. The ORDER BY clause determines the sequence in which the rows are assigned their unique ROW_NUMBER within a specified partition. In the above example we have not specified any partition columns, so the ROW_NUMBER is assigned based on the ordering of postal code column for each row.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. RANK()&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Segoe UI&#39;, Verdana, Arial; font-size: 13px; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;font-family: Consolas, Courier, monospace; font-style: normal; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;&quot;&gt;RANK ()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OVER ( [ &amp;lt; partition_by_clause &amp;gt; ] &amp;lt; order_by_clause &amp;gt; )&lt;/pre&gt;This function returns the rank of each row within the partition of a result set. The rank of a row is one plus the number of ranks that come before the row in question. You can also group the the rankings by using the PARTITION BY clause. In the above example the rankings are the same for rows having the same value in postal code column. But the ranking value keeps on incrementing for each row, so that when a new postal code value is encountered, ranking value on that new row will be one more than the number of proceeding rows.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. DENSE_RANK()&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Segoe UI&#39;, Verdana, Arial; font-size: 13px; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;font-family: Consolas, Courier, monospace; font-style: normal; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;&quot;&gt;DENSE_RANK ()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OVER ( [ &amp;lt; partition_by_clause &amp;gt; ] &amp;lt; order_by_clause &amp;gt; )&lt;/pre&gt;This function returns the rank of rows within the partition of a result set, without any gaps in the ranking. The rank of a row is one plus the number of distinct ranks that come before the row in question. In the above example rankings are incremented as the value in postal code column changes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. NTILE()&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Segoe UI&#39;, Verdana, Arial; font-size: 13px; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;font-family: Consolas, Courier, monospace; font-style: normal; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;&quot;&gt;NTILE (integer_expression)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OVER ( [ &amp;lt;partition_by_clause&amp;gt; ] &amp;lt; order_by_clause &amp;gt; )&lt;/pre&gt;This function distributes the rows in an ordered partition into a specified number of groups. The groups are numbered, starting at one. For each row, NTILE returns the number of the group to which the row belongs.  The integer constant expression specifies the number of groups into which each partition must be divided. In the above examples the rows are divided in 2 groups. Because the total number of rows(9) is not divisible by the number of groups, the first group has three rows and the remaining groups have two rows each.&lt;br /&gt;
&lt;br /&gt;
These functions can be really handy for complex sorting and generating sequential record set. These windowed functions can only be used in SELECT and ORDER BY statements. You can read more about them &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms189798.aspx&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/6298276107445370113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/sql-ranking-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/6298276107445370113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/6298276107445370113'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/sql-ranking-functions.html' title='SQL Ranking functions'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-2749346858780329971</id><published>2010-11-11T10:41:00.000+11:00</published><updated>2010-11-11T10:41:53.735+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Lambda Expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><title type='text'>LINQ Pad</title><content type='html'>I have been playing around with Entity Framework 4 and WCF Data Service lately. Whilst reading through some articles on these topics, I found this cool tool to play around with LINQ.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;&lt;a href=&quot;http://www.linqpad.net/&quot;&gt;LINQPad &lt;/a&gt;&lt;/span&gt;interactively lets you query data sources in a modern query&amp;nbsp;language. It supports everything in framework 4.0:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;LINQ to Objects&lt;/li&gt;
&lt;li&gt;LINQ to SQL&lt;/li&gt;
&lt;li&gt;LINQ to Entity Framework&lt;/li&gt;
&lt;li&gt;LINQ to XML&lt;/li&gt;
&lt;li&gt;OData/WCF Data Services&lt;/li&gt;
&lt;/ul&gt;It also comes loaded with lot of examples which can help you to learn LINQ. You can also execute&amp;nbsp;C#/VB expression, statement block or program with rich output formatting.&lt;br /&gt;
&lt;br /&gt;
LINQPad standard edition is free to download and use, but you can also get the premium edition with support for auto completion and some other features. So check it out &lt;a href=&quot;http://www.linqpad.net/&quot;&gt;http://www.linqpad.net/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/2749346858780329971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/linq-pad.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/2749346858780329971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/2749346858780329971'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/11/linq-pad.html' title='LINQ Pad'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-7590987363941827397</id><published>2010-10-14T17:05:00.000+11:00</published><updated>2010-10-14T17:05:22.269+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="parse convert string to enum c#"/><title type='text'>Convert string to enum</title><content type='html'>Number of times I have come across the situation where I wanted to convert a string into enum. Using switch case statements to return the enum becomes quite tedious when there are many items. Recently I found a static method in &lt;i&gt;Enum&lt;/i&gt; class which replaces these switch statements and is a big time saver.&lt;br /&gt;
&lt;pre class=&quot;brush: csharp;&quot;&gt;public static object Enum.Parse(System.Type enumType, string value)
&lt;/pre&gt;Look at the following code&lt;br /&gt;
&lt;pre class=&quot;brush: csharp;&quot;&gt;enum Days
{
  Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
}
//........

string val = &quot;Tuesday&quot;;
Days day = Enum.Parse(typeof(Days), val);
Console.WriteLine(&quot;Day Value: {0}&quot;, day.ToString());

//You can also ignore the case of the string being parsed 
//by using the following method
public static object Parse(Type enumType, string value, bool ignoreCase);
&lt;/pre&gt;Parsing an invalid day will throw an Argument Exception. So it is always a good idea to check if the enum exists, look at the following code:&lt;br /&gt;
&lt;pre class=&quot;brush: csharp;&quot;&gt;string val = &quot;Tuesday&quot;;
Day day;

if(Enum.IsDefined(typeof(Days), val))
  day = Enum.Parse(typeof(Days), val);
&lt;/pre&gt;Unfortunately, &lt;i&gt;Enum.IsDefined()&lt;/i&gt; does not provide ignore case option.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/7590987363941827397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/10/convert-string-to-enum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/7590987363941827397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/7590987363941827397'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/10/convert-string-to-enum.html' title='Convert string to enum'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-7216613487930096098</id><published>2010-09-18T20:24:00.001+10:00</published><updated>2010-09-18T22:48:31.171+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bitwise"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="enum"/><category scheme="http://www.blogger.com/atom/ns#" term="flag"/><title type='text'>C# Bitwise Flag Enum</title><content type='html'>Imagine there was a requirement for a notification system, where users could select multiple days for delivery in a week (eg: MON, TUE, WED, THU, FRI, SAT, SUN). Now you could do this by having Boolean flags for each option or a better way is to use bitwise enum flags. They store very efficiently in memory and manipulation is very fast.&lt;br /&gt;
&lt;br /&gt;
Before reading ahead, I would strongly suggest to read about bitwise operations &lt;a href=&quot;http://en.wikipedia.org/wiki/Bitwise_operation&quot;&gt;here&lt;/a&gt;, otherwise it will be very hard to understand the logic of the example.&lt;br /&gt;
&lt;br /&gt;
So lets declare our bitwise flag enum:&lt;br /&gt;
&lt;pre class=&quot;brush: csharp;&quot;&gt;[Flags]
private enum DeliveryDays
{
  NONE = 0, // 0000000
  MON = 1,  // 0000001
  TUE = 2,  // 0000010
  WED = 4,  // 0000100
  THU = 8,  // 0001000
  FRI = 16, // 0010000
  SAT = 32, // 0100000
  SUN = 64, // 1000000
  WORKDAYS = MON | TUE | WED | THU | FRI,  //0011111
  WEEKENDS = SAT | SUN  //1100000
}
&lt;/pre&gt;The [Flags] attribute indicates that an enumeration can be treated as a bit field. Do use powers of two for a enumeration&#39;s values so they can be freely combined using the bitwise OR operation. As you can see for workdays and weekends we have combined the relevant days. &lt;br /&gt;
&lt;br /&gt;
Now lets write down the methods which set these flags on or off.&lt;br /&gt;
&lt;pre class=&quot;brush: csharp;&quot;&gt;private DeliveryDays _selectedDays = DeliveryDays.None;

public void AddDeliveryDays(DeliveryDays days)
{
  _selectedDays |= days;
}

public void RemoveDeliveryDays(DeliveryDays days)
{
  _selectedDays &amp;amp;= ~days;
}


public void testDaysBitEnum()
{
  //lets select monday and tuesday
  AddDeliveryDays(DeliveryDays.MON | DeliveryDays.TUE);
  //lets change it all the work days
  AddDeliveryDays(DeliveryDays.WorkDays);
  //now lets remove monday and tuesday and add weekends
  RemoveDeliveryDays(DeliveryDays.MON | DeliveryDays.TUE);
  AddDeliveryDays(DeliveryDays.WEEKENDS);
}
&lt;/pre&gt;As shown above we can quickly toggle multiple flags. But we also need some functionality to find which flags have been selected. In .NET framework 4.0 the enum has a method called &lt;em&gt;HasFlag&lt;/em&gt; which does this for you. For older frameworks you can use the following method.&lt;br /&gt;
&lt;pre class=&quot;brush: csharp;&quot;&gt;public bool HasFlag(DeliveryDays day)
{
  return ((_selectedDays &amp;amp; day) == day);
}
&lt;/pre&gt;If you are using .NET 3.5 Framework it will be handy to add the above method as an Extension Method.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/7216613487930096098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/c-bitwise-flag-enum.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/7216613487930096098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/7216613487930096098'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/c-bitwise-flag-enum.html' title='C# Bitwise Flag Enum'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-4838408024972112360</id><published>2010-09-10T11:50:00.149+10:00</published><updated>2010-09-12T16:22:22.459+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="css"/><category scheme="http://www.blogger.com/atom/ns#" term="html"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="percentage"/><category scheme="http://www.blogger.com/atom/ns#" term="progress"/><category scheme="http://www.blogger.com/atom/ns#" term="progress bar"/><title type='text'>Progress Bar using css (cascading style sheet)</title><content type='html'>Recently I worked on some functionality where we wanted to show progress to users whilst they were answering a survey. Basically as they answered the questions a progress bar would show the completion percentage. As I started playing around with some css, it turned out be quite easy.&lt;br /&gt;
&lt;br /&gt;
Have a look at the example below:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;div class=&quot;progressContainer&quot;&gt;&lt;div class=&quot;progressBg&quot;&gt;&lt;/div&gt;&lt;div class=&quot;progressText&quot;&gt;Progress&lt;/div&gt;&lt;/div&gt;&lt;input onclick=&quot;progress();return false;&quot; type=&quot;button&quot; value=&quot;Animate&quot; /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input onclick=&quot;changeProgress(14);return false;&quot; type=&quot;button&quot; value=&quot;+&quot; /&gt;&amp;nbsp;&lt;input onclick=&quot;changeProgress(-14);return false;&quot; type=&quot;button&quot; value=&quot;-&quot; /&gt;&lt;/div&gt;&lt;style type=&quot;text/css&quot;&gt;
.progressContainer
{ width: 148px; height: 20px; border:1px solid Gray; position:relative; }
.progressBg { position:absolute; top:0; left:0; bottom:0; background: RGB(165,186,125); width: 0%; z-index:10; }
.progressText { position:absolute; top:0; left:0; bottom:0; right: 0; z-index:20; text-align:center; }
&lt;/style&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function progress() {
$(&quot;.progressBg&quot;).animate({width: &quot;100%&quot;},1000);
}
function changeProgress(val){
var operation = &quot;+=&quot;;
if(val &lt; 0)
{
  if(($(&quot;.progressBg&quot;).width() + val) &lt; 0)
  {
    val = ($(&quot;.progressBg&quot;).width() - 148);
  } 
  operation = &quot;-=&quot;; 
  val = val * -1;
}
else
{
  if(($(&quot;.progressBg&quot;).width() + val) &gt; 148)
  {
    val = (148 - $(&quot;.progressBg&quot;).width());
  }
}
$(&quot;.progressBg&quot;).animate({width: operation+val},1000);
}
&lt;/script&gt;&lt;br /&gt;
The above progress bar is made of three div tags,&lt;br /&gt;
1. The outer container div with a border which works as a place holder for the progress and the text being displayed&lt;br /&gt;
&lt;pre class=&quot;brush: css;&quot;&gt;&lt;style type=&quot;text/css&quot;&gt;
.progressContainer
{ 
  width: 148px; height: 20px; 
  border:1px solid Gray; 
  position: relative; 
}
&lt;/style&gt;&lt;/pre&gt;&lt;pre class=&quot;brush: html;&quot;&gt;&lt;div class=&quot;progressContainer&quot;&gt;&lt;/div&gt;&lt;/pre&gt;The relative positioning of this container ensures that all it&#39;s child div tags are contained within.&lt;br /&gt;
&lt;br /&gt;
2. Next is the div container which will sit inside the above div and show the progress. This is just an absolute positioned div with a background color or an repeater image. Basically, we just change the width of this div to show the increase in progress.&lt;br /&gt;
&lt;pre class=&quot;brush: html;&quot;&gt;&lt;style type=&quot;text/css&quot;&gt;
.progressContainer
{ 
  width: 148px; height: 20px; 
  border:1px solid Gray; 
  position: relative; 
}
.progressBg 
{ 
  position:absolute; 
  top:0; left:0; bottom:0; 
  background: RGB(165,186,125); 
  width: 0%; 
  z-index:10; 
}
&lt;/style&gt;

&lt;div class=&quot;progressContainer&quot;&gt;&lt;div class=&quot;progressBg&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;3. The third div is another absolute positioned container which will sit inside the place holder div tag to show the text. The important thing to notice about it&#39;s style is that, it completely fills the place holder div with a transparent background so you can see the progress. The higher z-index ensures that it will sit on top of the div showing the progress in background.&lt;br /&gt;
&lt;pre class=&quot;brush: html;&quot;&gt;&lt;style type=&quot;text/css&quot;&gt;
.progressContainer
{ 
  width: 148px; height: 20px; 
  border:1px solid Gray; 
  position: relative; 
}
.progressBg 
{ 
  position:absolute; 
  top:0; left:0; bottom:0; 
  background: RGB(165,186,125); 
  width: 0%; 
  z-index:10; 
}
.progressText 
{ 
  position:absolute; 
  top:0; left:0; bottom:0; right: 0; 
  z-index:20; 
  text-align:center; 
}
&lt;/style&gt;

&lt;div class=&quot;progressContainer&quot;&gt;&lt;div class=&quot;progressBg&quot;&gt;&lt;/div&gt;&lt;div class=&quot;progressText&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;Now what you need is some jquery to manipulate the width of the div showing the progress. As an example:&lt;br /&gt;
&lt;pre class=&quot;brush: js;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
function animateProgress() {
  $(&quot;.progressBg&quot;).animate({width: &quot;70%&quot;},1000);
}
&lt;/script&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/4838408024972112360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/progress-bar-in-html-using-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4838408024972112360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/4838408024972112360'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/progress-bar-in-html-using-css.html' title='Progress Bar using css (cascading style sheet)'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-5523205011317115162</id><published>2010-09-08T15:22:00.013+10:00</published><updated>2010-10-20T13:27:42.196+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="content"/><category scheme="http://www.blogger.com/atom/ns#" term="css"/><category scheme="http://www.blogger.com/atom/ns#" term="html"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="scroll"/><category scheme="http://www.blogger.com/atom/ns#" term="scroller"/><category scheme="http://www.blogger.com/atom/ns#" term="scrolling"/><category scheme="http://www.blogger.com/atom/ns#" term="vertical"/><title type='text'>Vertical Content Scrolling</title><content type='html'>There are lot of jquery plugins available which provides horizontal or vertical content scroll functionality, like for scrolling through image gallery. Recently I had a requirement where a web page needed vertical scrolling functionality for a navigation system.&lt;br /&gt;
&lt;br /&gt;
Below is a very simple example, where content of a list is being scrolled by two buttons.&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function scrollSections(val) {
            $(&#39;#list&#39;).animate({
                scrollTop: $(&#39;#list&#39;).scrollTop() + (val)
            }, 450);
        }
&lt;/script&gt;&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
div#list { height: 100px; overflow:hidden; border: 1px solid black;}
ul#navigationList { position: relative;list-style-type: none; }
ul#navigationList li { width: 100px; height:20px; vertical-align:middle; border: 1px solid black; margin:5px; padding-left:5px;}
&lt;/style&gt;&lt;br /&gt;
&lt;div&gt;&lt;input onclick=&quot;scrollSections(-50);return false;&quot; type=&quot;button&quot; value=&quot;UP&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;list&quot;&gt;&lt;ul id=&quot;navigationList&quot;&gt;&lt;li&gt;Item 0&lt;/li&gt;
&lt;li&gt;Item 1&lt;/li&gt;
&lt;li&gt;Item 2&lt;/li&gt;
&lt;li&gt;Item 3&lt;/li&gt;
&lt;li&gt;Item 4&lt;/li&gt;
&lt;li&gt;Item 5&lt;/li&gt;
&lt;li&gt;Item 6&lt;/li&gt;
&lt;li&gt;Item 7&lt;/li&gt;
&lt;li&gt;Item 8&lt;/li&gt;
&lt;li&gt;Item 9&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;input onclick=&quot;scrollSections(50);return false;&quot; type=&quot;button&quot; value=&quot;Down&quot; /&gt;&lt;/div&gt;&lt;br /&gt;
So lets get into this,&lt;br /&gt;
1. First we need to create a div tag with it&#39;s style overflow attribute set to hidden.&lt;br /&gt;
&lt;pre class=&quot;brush: css; highlight: [5];&quot;&gt;&lt;style type=&quot;text/css&quot;&gt;
div#list 
{ 
  height: 100px; 
  overflow:hidden; 
  border: 1px solid black;
}
&lt;/style&gt;
&lt;/pre&gt;&lt;pre class=&quot;brush: html;&quot;&gt;&lt;div id=&quot;list&quot;&gt;&lt;/div&gt;&lt;/pre&gt;2. Add the content.&lt;br /&gt;
&lt;pre class=&quot;brush: css;&quot;&gt;&lt;style type=&quot;text/css&quot;&gt;
div#list 
{ 
  height: 100px; 
  overflow:hidden; 
  border: 1px solid black;
}
ul#navigationList 
{ 
  list-style-type: none; 
}
ul#navigationList li 
{ 
  width: 100px; height:20px; 
  vertical-align:middle; 
  border: 1px solid black; 
  margin:5px; padding-left:5px;
}
&lt;/style&gt;
&lt;/pre&gt;&lt;pre class=&quot;brush: html;&quot;&gt;&lt;div id=&quot;list&quot;&gt;&lt;ul id=&quot;navigationList&quot;&gt;&lt;li&gt;Item 0&lt;/li&gt;
&lt;li&gt;Item 1&lt;/li&gt;
&lt;li&gt;Item 2&lt;/li&gt;
&lt;li&gt;Item 3&lt;/li&gt;
&lt;li&gt;Item 4&lt;/li&gt;
&lt;li&gt;Item 5&lt;/li&gt;
&lt;li&gt;Item 6&lt;/li&gt;
&lt;li&gt;Item 7&lt;/li&gt;
&lt;li&gt;Item 8&lt;/li&gt;
&lt;li&gt;Item 9&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;/pre&gt;3. Now for scrolling, we will use jquery&#39;s animate function which will provide us a smooth scrolling effect.&lt;br /&gt;
&lt;pre class=&quot;brush: js;&quot;&gt;&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;
&lt;/script&gt;
function scroll(val) {
            jQuery(&#39;#list&#39;).animate({
                scrollTop: jQuery(&#39;#list&#39;).scrollTop() + (val)
            }, 450);
        }
&lt;/pre&gt;The above function takes a integer parameter which gets added to the scrollTop attribute of the div containing the content, which causes the content to scroll. The animate function makes the transition smoother, to read more about animate function go &lt;a href=&quot;http://api.jquery.com/animate/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
4. Now what we need is just two buttons, which will call this function and pass +ve values to scroll down and -ve values to scroll up. &lt;br /&gt;
&lt;pre class=&quot;brush: html;&quot;&gt;&lt;input onclick=&quot;scroll(-50);return false;&quot; type=&quot;button&quot; value=&quot;UP&quot; /&gt;
&lt;input onclick=&quot;scroll(50);return false;&quot; type=&quot;button&quot; value=&quot;DOWN&quot; /&gt;
&lt;/pre&gt;&lt;br /&gt;
This a very simple example, but gives a good idea for building cool vertical content scrolling.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/5523205011317115162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/vertical-content-scrolling.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/5523205011317115162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/5523205011317115162'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/vertical-content-scrolling.html' title='Vertical Content Scrolling'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-5027415493034289146</id><published>2010-09-06T12:07:00.001+10:00</published><updated>2010-09-06T12:09:45.990+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="check"/><category scheme="http://www.blogger.com/atom/ns#" term="string is empty"/><category scheme="http://www.blogger.com/atom/ns#" term="string is null"/><title type='text'>Check if string is null or empty.</title><content type='html'>I have seen so many lines of code where people write checks for a string being null or blank. Also, sometimes there is no check for string being empty.&lt;br /&gt;
For example:&lt;br /&gt;
&lt;script class=&quot;brush: csharp&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;![CDATA[

if(strName != null || strName != String.Empty)
{
    //your code....
}

]]&gt;
&lt;/script&gt;&lt;br /&gt;
There is a better way of doing this, there is very neat static function in the String class which does this check for you&amp;nbsp;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas; font-size: 13px;&quot;&gt;IsNullOrEmpty(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas; font-size: 13px;&quot;&gt; value).&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Consolas; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;script class=&quot;brush: csharp&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;![CDATA[

if(!String.IsNullOrEmpty(strName))
{
    //your code....
}

// If you also want to check for white spaces, 
// instead of trimming the string use this method
if(!String.IsNullOrWhiteSpace(strNames))
{
    //your code....
}
]]&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/5027415493034289146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/check-if-is-string-is-null-or-empty.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/5027415493034289146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/5027415493034289146'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/check-if-is-string-is-null-or-empty.html' title='Check if string is null or empty.'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-6121493981877062747</id><published>2010-09-05T15:18:00.000+10:00</published><updated>2010-09-05T15:18:34.831+10:00</updated><title type='text'>Tuple in C# 4.0</title><content type='html'>C# 4.0 includes a new feature called Tuple. Tuple provides us with a way to group elements of disparate data types together.This is present in functional languages like Haskell and also dynamic languages like Python.&lt;br /&gt;
&lt;br /&gt;
Consider the following code:&lt;br /&gt;
&lt;script class=&quot;brush: csharp&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;![CDATA[
static void Main(string[] args)
{
    var t = Tuple.Create&lt;string, int&gt;(&quot;Jane Doe&quot;, 34);
    Console.WriteLine(&quot;Name: {0}&quot;, t.Item1);
    Console.WriteLine(&quot;Age: {0}&quot;, t.Item2);
    Console.Read();
}
]]&gt;
&lt;/script&gt;It creates a tuple storing name and age of person.&lt;br /&gt;
&lt;br /&gt;
We can create nested tuples as shown below:&lt;br /&gt;
&lt;script class=&quot;brush: csharp&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;![CDATA[
static void Main(string[] args)
{
    var t = Tuple.Create(&quot;John Doe&quot;, 34,new Tuple&lt;string,string&gt;(&quot;Melbourne&quot;,&quot;Australia&quot;));
    Console.WriteLine(t);
    Console.Read();
}
]]&gt;
&lt;/script&gt;&lt;br /&gt;
The most important thing to know about the Tuple type is that it is a class, not a struct, and thus will be allocated upon the managed heap. Each class instance that is allocated adds to the burden of garbage collection. The properties Item1, Item2, and further do not have setters, so you cannot assign them. The Tuple is immutable once created in memory.&lt;br /&gt;
&lt;br /&gt;
It is difficult for developers to choose between Tuples and Anonymous Types as they serve similar purpose. It can be a difficult to make the best choice between those two solutions.&lt;br /&gt;
&lt;br /&gt;
Read more about it &lt;a href=&quot;http://msdn.microsoft.com/en-us/vcsharp/ee957397.aspx&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/6121493981877062747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/tuple-in-c-40.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/6121493981877062747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/6121493981877062747'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/tuple-in-c-40.html' title='Tuple in C# 4.0'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-691412763785419828</id><published>2010-09-04T17:45:00.001+10:00</published><updated>2010-09-04T18:18:30.352+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Extension methods"/><title type='text'>Extension Methods</title><content type='html'>Extension methods behavior is similar to that of static methods. You can declare them only in static classes. To declare an extension method, you specify the keyword &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;this &lt;/span&gt;as the first parameter of the method, for example&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;static class StackOps
{
   public static void Push&amp;lt;T&amp;gt;(this List&amp;lt;T&amp;gt; TheList, T Value)
   {
      TheList.Add(Value);
   }

   public static T Pop&amp;lt;T&amp;gt;(this List&amp;lt;T&amp;gt; TheList)
   {
      if (TheList.Count == 0)
         throw new Exception(&quot;Nothing to pop.&quot;);
      
      int LastPos = TheList.Count - 1;
      T Result = TheList[LastPos];

      TheList.RemoveAt(LastPos);
      return Result;
   }
}


static void Main(string[] args)
{
   var Stack = new List&amp;lt;int&amp;gt;();

   // Put stuff onto the stack.
   for (int i = 0; i &amp;lt;= 10; i++)
      Stack.Push(i);

   // And now pop stuff off it.
   while (Stack.Count &amp;gt; 0)
      Console.WriteLine(Stack.Pop());
}
&lt;/pre&gt;&lt;br /&gt;
Read more about Extension Methods &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb383977.aspx&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/691412763785419828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/extension-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/691412763785419828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/691412763785419828'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/extension-methods.html' title='Extension Methods'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-3028999308556272161</id><published>2010-09-04T17:36:00.001+10:00</published><updated>2010-09-04T18:35:00.624+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Lambda Expressions"/><title type='text'>C# Lambda Expressions</title><content type='html'>A lambda expression simply defines an anonymous function. All lambda expressions use the lambda operator =&amp;gt;, which is read as &quot;goes to&quot;. The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block.&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush: csharp&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;![CDATA[

//Example: Find all the items except with the value 9.
List&amp;lt;int&amp;gt; list = new List&amp;lt;int&amp;gt;();

//The old way
List&amp;lt;int&amp;gt; matches = list.FindAll(delegate(int val) { return val != 9; });

//With Lambda Operator
List&amp;lt;int&amp;gt; matches = list.FindAll(val =&amp;gt; val != 9);

//Example: Find Odd numbers
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
int oddNumbers = numbers.Count(n =&amp;gt; n % 2 == 1);
]]&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Read more about lambda expressions &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb397687.aspx&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/3028999308556272161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/c-lambda-expressions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3028999308556272161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3028999308556272161'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/c-lambda-expressions.html' title='C# Lambda Expressions'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6122772622766163989.post-3571106773184438898</id><published>2010-09-04T16:31:00.000+10:00</published><updated>2010-09-04T16:39:29.983+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="delimited string"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><category scheme="http://www.blogger.com/atom/ns#" term="t-sql"/><category scheme="http://www.blogger.com/atom/ns#" term="table column"/><title type='text'>SQL Server - Comma delimited string from a table column</title><content type='html'>This is a very simple and efficient way of getting values of a column in a delimited string.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium; line-height: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;USE&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;AdventureWorks&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;GO&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;DECLARE&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: #434343; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;@nameslist&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MAX&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: #434343; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;@nameslist&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: magenta; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;COALESCE&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: #434343; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;@&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #434343;&quot;&gt;nameslist&lt;/span&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: red; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&#39;,&#39;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: red; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;) +&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Name&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Production.Product&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;&lt;span style=&quot;color: #434343; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;@&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #434343; font-family: monospace; font-size: 12px; line-height: 19px;&quot;&gt;nameslist&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #434343; font-family: monospace; font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 19px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Using the&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;COALESCE&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;function ensures that result set does not get affected by null values. For more information about this function check out this &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms190349(SQL.90).aspx&quot;&gt;link&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://dotnet-journey.blogspot.com/feeds/3571106773184438898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/sql-server-comma-delimited-string-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3571106773184438898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6122772622766163989/posts/default/3571106773184438898'/><link rel='alternate' type='text/html' href='http://dotnet-journey.blogspot.com/2010/09/sql-server-comma-delimited-string-from.html' title='SQL Server - Comma delimited string from a table column'/><author><name>Gurnam Madan</name><uri>http://www.blogger.com/profile/09288613350862733684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg34xbqqjqgM3ncY2UB1v5q0j5YXivhV8XIwf2ZrnoIy7C-Wmaa22jJ4YT-84SiK0EiSmTAwyf51YmeKbKwgR3kIqGJdNXWC-XYJ8XuKMXaLVFE6uM-pAQEwxxdtTSRmDo/s220/butters.jpg'/></author><thr:total>0</thr:total></entry></feed>