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: http://msdn.microsoft.com/en-us/library/system.data.isolationlevel.aspx. 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.