Building a Data Access Layer with a User-Defined Type

In this final section, let’s actually do something with our new user-defined type. We create a new data access component that uses the DBMovie class and an ASP.NET page that interfaces with the component.

Before we can do anything with the DBMovie type, we need to add a reference to the DBMovie.dll assembly to our application. In Visual Web Developer, select Website, Add Reference, and browse to the DBMovie.dll. Alternatively, you can create an application root Bin folder and copy the DBMovie.dll into the Bin folder.

Our new data access component is contained in Listing 19.37.

Listing 19.37. App_Code\DBDataLayer.cs

The component in Listing 19.37 contains two methods: GetAll() and Insert() ...

Get ASP.NET 4 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.