Using an Object for an Id
It's not that uncommon to use an ID for a data object. However, sometimes more information is needed to uniquely identify an object than a number. In these cases is useful to use another object. It can contain an integer, guid, date created, created by, or even the date and time and object was modified. A good example of this would be a content management system. A given piece of content could have a content object ID, which would contain an ID, the day and time of the modification,...
[More]
Beyond Generics, Interfaces, Providers and You : IReadByParentId
Ok so in the Generics, Interfaces, Providers and You series, Part 1, Part 2, Part 3 & Part 4, we made a flexible system of interfaces to make working with a data access provider model easier. In Part 4, I listed some ideas where there was room for improvement in the interfaces/class that we made. If you have not read the series yet, go ahead and take a few minutes to read them; this post will not make much sense without it. So here it is, the IReadByParentId interface(s). Of course we...
[More]
Generics, Interfaces, Providers and You - Part 4: Building the Classes
Now that we have our interfaces we need to make some changes to our existing objects. Back in part 1 we defined an object tree for contact information. For this example, a 3rd parting marketing system is loading new contact information into our data store and management does not want anyone to delete data, but in a truely pointy hair boss fashion they want people to be able to update the data... First we will create the ContactInformationProviderRepository. We make a static Provide...
[More]
Generics, Interfaces, Providers and You - Part 3:IProviderCollection & IProviderRepository
In part 1 We talked about the web.config and the basic classes to get started with a provider model. Part 2 covered the interface for the data object and the Provider. Now in part 3 we will address the IProviderCollection and the IProviderRepository. Back in part one we added a provider collection to the generic provider repository by taking the provider collection as a generic parameter. Now we are going to define the ProviderCollection interfaces. They are going to be ICreateProvi...
[More]
Generics, Interfaces, Providers and You - Part 2:IDataObject & IProvider
In part 1 we covered the web.config changes and the classes needed to use them. We also created a ProvidersRepositoryGeneric class to load and manage providers. But what good is a repository of providers if there is nothing to provide? While the Provider model can be used for other things aside from data operations, this series is focusing on data access. If you need a moment to go back and read Generics, Interfaces, Providers and You - Part 1:Getting Started feel free, we will be he...
[More]
Generics, Interfaces, Providers and You - Part 1:Getting Started
There are many uses for providers with accessing a data store being one of the most common. I'm not going to talk about why to use providers, I am going to address how to use generics and interfaces with providers to make using them a bit easier. For this series we are going to use a "ContactInformation" object with a few sub-classes, "HomePhoneNumber" and "EmailAddress". using System;
using System.Collections.Generic;
using System.Text;
using ObjectHelpDesk.DataAcc...
[More]