Accessing data - Choose data access technologies

DataSet or DataReader?

Although ADO.NET is versatile, powerful, and easy to use, it’s the simplest of the choices available. When studying for the exam, you won't have to focus on learning every nuance of every minor member of the System.Data or System.Data.SqlClient namespace. This is a Technical Specialist exam, so it serves to verify that you are familiar with the technology and can implement solutions using it. Although this particular objective is titled “Choose data access technology,” you should focus on how you’d accomplish any given task and what benefits each of the items brings to the table. Trying to memorize every item in each namespace is certainly one way to approach this section, but focusing instead on “How do I populate a DataSet containing two related tables using a DataAdapter?” would probably be a much more fruitful endeavor.

ObjectContext entities

As noted earlier, you need to pay attention to the derived class that the given context is derived from because it is likely to be included in the exam. The same is the case with entities that derive from the EntityObject base class. These entities have several attributes decorating the class definition that you should be familiar with. There are also several similar distinctions surrounding properties of each entity class (or attributes, as they are called in the conceptual model).

Accessing data - Implement caching

Using the HttpContext.Cache

When taking the exam, you might see questions that specifically reference the HttpContext.Cache (or Page.Cache or some other similar form) directly. Such a question might be: “Datum Corporation has an application that’s currently caching several collections of data in the HttpContext.Cache object. You need to _____. How should you do it?” In such cases, you can and should make the assumption that the application is an ASP.NET application or a WCF Data Service hosted inside of ASP.NET. Everything else that makes reference to caches (from determining what mechanism should be used the whole way to specific implementations) should be assumed to be referencing the ObjectCache unless specifically stated otherwise.

Accessing data - Implement transactions

Specifying a transaction isolation level

The IsolationLevel enumeration values have not changed since the enumeration was introduced initially. Table 1-6 covers each of the values and what they do, but you would be well advised to learn each of these and understand them. The official documentation for each behavior is available on MSDN at the following URL: Because questions regarding IsolationLevel are very likely to appear on the exam, by understanding what each level does, you’ll be able to distinguish the correct answer based on requirements mentioned in the question. You’ll likely see something in a question stub indicating that you need to allow or prevent exclusive range locks or you need to ensure that users are prevented from reading data locked by other transactions. Such verbiage is a dead giveaway to which isolation level is correct.

Accessing data - Create and implement a WCF Data Services service

Creating a query

Most developers and even computer science students who are not just starting their programs are familiar with SQL. SQL is easy to learn, and it’s so common that most people have come across it. Although I can run through every single query and feature available through OData and toying with the URIs, understanding how different URIs translate to SQL might be helpful to drive home your understanding. I’ve seen quite a few cases in which people have missed questions on this exam that they unquestionably knew the SQL for, but got confused on the OData portion. If you create a service, turn on Profiler in SQL Server and watch the results as you change different URIs; you’ll see exactly what it’s being translated to behind the scenes. Watching what’s going on in Profiler is a very helpful learning tool in many cases, not just this one. It does add a slight resource load to the SQL Server, so clear it with your DBA or use an instance that you know isn’t being used by anyone for anything important at the time. I highly recommend that you do a quick runthrough, watching what happens in Profiler just to drive the point home if you have any extra time to do so.

Creating a query

In the exam, you’ll probably be presented with some definition of an Entity Model (even if it’s just a small piece of it) and then ,told that you need to “create a query that… .” You’ll then be presented with a list of possible queries that would return the desired results. Understanding the items in Table 1-12 and how they affect the resulting query is indispensable for answering such questions correctly. $orderby, $select, $top, and $inlinecount are obvious in what they do and how they are used, and there’s not much to them. That leaves $filter, $skip, and $expand to study.

Query and manipulate data by using the Entity Framework - LINQ to Entities

Querying data using LINQ operators

You can use the var keyword, but an exam question might call it out with either IQueryable or IEnumerable. Note, however, that this doesn’t mean one or the other is being used; both support either/both interface types.

Create a WCF service

Creating contracts

On the exam, if you see a custom data type, remember that you must be able to serialize it. As such, the class definition should be decorated with a DataContract attribute or another serializer type. Custom exception types can also be presented. These should be decorated with a FaultContract attribute.


Although custom bindings are something you need to be familiar with if you are planning on working with WCF, anything more complicated than their simple existence is unlikely to appear on the exam.


On the exam, EmitDefaultValue might be used in a question about how the size of the serialized message must be kept to an absolute minimum or about it might be mentioned as part of interoperability issues and the serialization format specifically.

Configure WCF services by using configuration settings

Config files

There are several questions in the exam that show you a section of a configuration file on one side of the screen, with blank boxes over key elements, and the available choices on the other side of the screen. You are asked to drag and drop those elements in the correct places. You need to get all the items correct in order to get the question right.

Configuring bindings

Remember that, even if you don’t know the answer to a question, if you can eliminate any wrong choices you immediately increase your chances of getting the item correct. On the new versions of the exam, in which you have all the drag-and-drop items, you have to get several things right in order to get the item correct, and you might find a question that has three empty boxes that need answers, but x (where x > 3) available choices. In the previous item, just by reviewing the resulting items that are created from the configuration file, you can know that the answer will have either binding=somebinding or bindingconfiguration=someconfiguration (or both) because they are the only two possible attributes that are available outside of scheme. If the only bindings you saw were netMsmqBinding or new NamedPipeBinding, that is your answer, even if the use case isn’t something that you would typically want to do because no other attributes are allowed to exist there.

Consume WCF services

Generating proxies by creating a service reference

For test questions, the only things that you might be asked about on this portion are whether to use the Go feature coupled with a URI, the Discover option, or about specifying a specific namespace.

Design a Web API

Creating the controller

If the query parameters don’t return a matching value, you have several ways to respond, just as you would any other query. Although you can opt to return a null value, a more elegant and expressive means is to throw an HttpResponseException. The HttpResponseException class has two overloads you can use: The first is to specify an HttpStatusCode enumeration value, and the second is an HttpResponseMessage. The HttpStatusCode enumeration provides several common and intuitive codes, and in this case, the value of NotFound fits both logically and mechanically. Make sure that you understand how to use HttpStatusCode for the exam to return meaningful responses to the client.

Creating the controller

Experiment with calling your Web API by accessing all action methods through their URL. Try passing different values for parameters such as accountId. Also pass an invalid value so you get back an HTTP 404 error (the result of HttpResponseException’s HttpStatusCode).

Creating the controller

There are HTTP actions defined in two obvious namespaces: System.Web.Http and System. Web.Mvc. They both have their use and place in the application, but in this sample, the one in the System.Web.Http namespace is the one that should be used. Because there are some other classes in the System.Web.Mvc namespace, it is incredibly easy to accidentally use the incorrect one, so be careful here! Equally as confusing is the AcceptVerbsAttribute, which also exists in both places. Yet it is important to use the one in the System.Web.Http namespace. So how do you know when to use one versus the other? It’s quite simple! Look at your controller and see what the base class is. If it’s ApiController, you should use the System.Web.Http namespace. If it’s not, use the System.Web.Mvc namespace for them. It’s certainly possible for both to exist within the same project!

Secure a Web API

Preventing cross-site request forgery

If you’re unfamiliar with XSRF, provides a wonderful and very thorough description of it. A summary description of XSRF is simply when a different website or application (even email links) attempts to access a resource that requires authentication to trigger some action that has some side effect.

How to protect from XSRF

Of course, it’s not required to memorize all the code involved in checking the antiforgery tokens. You do need to make sure that you understand the ideas behind it. Sending two values, one in a cookie and one in the form data, and making sure these values match is the basic idea for protecting against XSRF. A good practice is to create a simple Web API that is vulnerable to XSRF and then protecting it so you understand all steps involved. An example can be found at

Host and manage a Web API

Creating your Web API hosting server

Remember to add the default route when self-hosting your Web API. In a web application, this configuration is automatically created for you, but you should add it yourself when self-hosting.

Hosting services in a Windows Azure worker role

Deploying a Web API to Windows Azure Websites doesn’t require any more extra steps than deploying it to an on-premises IIS.

Consume Web API web services

HttpGet via GetAsync

Make sure that you understand how async and await work. Although they’re not explicitly mentioned in the exam objectives, they’re a fundamental part of C# 5. If you haven’t studied async and await yet, see Exam Ref 70-483: Programming in C#, by Wouter de Kort, or start at

Sending and receiving requests in different formats

To prepare for the exam, you can follow the example at overview/formats-and-model-binding/media-formatters. It shows you how to create your own formatter and how to use it.

Design a deployment strategy

Automating a deployment from TFS or Build Server

The exam states that you should know how to automate a deployment from TFS or Build Server. Knowing the conceptual idea behind automatic deployments can help you if you get any scenarios about it on the exam.

Automating a deployment from TFS or Build Server

For the exam, it’s good to know that TFS is hosted on-premises on your own server. Team Foundation Service is hosted in the cloud and is updated every three weeks.

Deploying to web farms

It’s important to know the difference between scaling up and scaling out for the exam. Make sure that you understand the advantages and disadvantages of both solutions.

Configure a web application for deployment

Using SetParameters to set up an IIS app pool

Make sure that you understand both web.config transformations and the use of parameters. Remember that transformations are done at compile time, and parameter values are set during deployment.

Manage packages by using NuGet

Installing and updating an existing NuGet package

Remember that a NuGet package is not only about adding references to your project. A NuGet package can contain all kinds of data, such as code or script files and even configuration changes that can be added to your project.

Share assemblies between multiple applications and servers

Signing assemblies by using a strong name

Make sure that you understand the benefits of signing an assembly. Also make sure that you know when to use delayed signing.

Implementing assembly versioning

The probing option can be used only to point to locations that are relative to the application path. If you want to locate assemblies somewhere else, you have to use the codebase element.