Registering Generic Classes
NCache also supports generic classes to be compact serialized. Generic classes
are configured in the same way as other classes. In addition, we also need to
<T> types for each Generic class.
Click on the cache name in Cache Explorer to open cache settings.
Go to the Compact Serialization tab.
Click on the Add Type button. Select Compact Classes dialog appears.
Click on the Show Default Generics button. It lists default generic types.
Select the desired type and click Add Class. If you want to select your own custom generic class, click on the Browse button in the same dialog box and select your assembly.
- It adds selected classes in the lower pane. Click OK to add classes for compact serialization.
- All of the selected classes are now listed at Compact Serialization tab in NCache Manager.
Now you need to specify the classes, which you expect to be assigned to the selected generic classes. When you select any of the added generic class, the Add< T > button becomes enabled.
Click Add< T >.
Select Compact Classes dialog appears. Click Browse to select assembly.
All classes will be loaded in Loaded Classes list box.
Select your class and click Add Class.
If you want to add primitive type as
<T>, then click on Add Primitive
- Click OK.
It adds generic
<T> type under the selected generic class.
- This way you can specify as many
<T>types for a generic class as needed.