The ObjectDataSource does not have any kind of design time support
to use generic types and it does't support generic methods.
The CompatObjectDataSource and the ExtendedObjectDataSource
have full support for generic types and generic methods to not restrict the developer's
The syntax to specify a generic type is the same supported by the .NET Framework
For example, the generic type:
represents the class System.Collections.Generic<int>.
For non framwork types the assembly name is also required so the syntax can be quite
Manu.GenericTests.GenericDAO`1[[Manu.Business.Product, Business]], __code
represents the class Manu.GenericTests.GenericDAO<Manu.BusinessProduct>, where
the Product class is in an assembly called Business and the GenericDAO class is
in the App_Code folder.
For generic methods, a similar syntax is available. For example:
GetObjectList`2[System.String, [Manu.GenericTests.Country, __code]]
is used to represent the GetObjectList<string, Manu.GenericTests.Country>
To hide the complexity of generics, the CompatObjectDataSource
and the ExtendedObjectDataSource have full design time support,
so the developer does not need to know the underlying details.
The following example will use a generic method to get some data stored in a registry.
When the application starts a registry is created and some data is stored in it.
Among those data there is a list of available countries. The registry has the following
public class Registry
public T GetObject<K, T>(K
GetObjectList<K, T>(K key);
RegisterObject<K, T>(K key, T obj);
RegisterObjectList<K, T>(K key, IList<T>
The example use a CompatObjectDataSource to populate a DropDownList with the country
list from the registry using the GetObjectList<string, Country> method.