Vendor independent or provider agnostic data access is a relatively easy thing to implement, thanks to the structure of ADO.NET. You’ll find the classes you’d need in the System.Data.Common namespace.
To access data without knowing the provider type, you’d start in your web.config, by adding these entries to it:
<add name=”theString” connectionString=”your string here” providerName=”System.Data.SqlClient”/>
<add key=”select” value=”SELECT * FROM Customers”/>
Then in your data access class, you should define a DBProviderFactory, create an instance of it by calling the GetFactory static method passing the provider type as parameter (defined in your web.config). Then you should create a DBConnection class and a DBCommand class, or anything else you’d need, and use it as if you’d use for example the SQL classes. Example:
There are a lot of objectives in 70-564 which I’ve published already in my series about 70-562. These objectives (at least, from my part) require only a little re-reading, and digging in MSDN. So I won’t publish separate posts for them. They are as follows:
Master pages are a very powerful feature to provide a consistent look and feel for your site. They also help you focus on the content of each individual page, rather than re-implementing for example the navigation of your page each time.
However, sometimes you need to access the master page from one of your content pages (the other way around makes less sense). A cool thing to do is to create strongly-typed master pages. This is achieved by only a single directive, called MasterType. It looks like this:
<% @MasterType virtualPath=”~/MasterPage.master” %>
Themes allow you to build sites with a consistent layout. You can set them up by adding an App_Themes directory for your application, and fill it up with folders. Each folder in the App_Themes directory represents a theme. You can assign them in a number of ways, in each case using the folder name to identify the theme.
There are five levels of applying themes:
- @Page Theme
- Web.config <pages Theme=””>
- Local control attributes
- @Page StyleSheetTheme
- Web.config <pages StyleSheetTheme=””>
A level at the beginning of the list overrides one at the end. So when you set a theme in the Page directive, it will override all the other style settings.
As I mentioned yesterday, my current goal is to earn an MCPD credential in ASP.NET. Given this, I must take the 70-564 exam, called PRO: Designing and Developing ASP.NET Applications.
I really don’t have an idea what this exam might look like, I found suggestions that this one is focusing on what should you do rather than how would you do it. So no more constructor overloads to memorize, just understand what and why you’d implement.
Now that’s a cool thing, but unfortunately, there’s no MeasureUp questions for this. The Training Kit is out by now, but with a price I don’t consider to be acceptable for it (it’s about a hundred dollars currently).
Because of the lack of practice questions, I’ll sit on the exam on next week, just to see what it’s all about (with the help of Second Shot, of course). Until then, I’ll use three resources to learn: Matthew MacDonald’s and Mario Szpuszta’s Pro ASP.NET 3.5 in C# 2008, which I have used to prepare for the MCTS 70-562 before, but now I’ll focus on the advanced stuff.
There’s a free Microsoft book, called Microsoft Application Architecture Guide, v2.0. This one will be most useful for the questions about how to design an ASP.NET application. Last resource is of course the MSDN.
I’ll post regularly as I progress through the syllabus of the exam.