identity-map

What is the best structure to implement an Identity Map?

Although a DataTable is a memory hog, wouldn't a DataTable be the best choice to implement and IdentityMap if the set of objects is very large since retrieval time is O(1)? Update If I decide to use IDictionary, do I sacrifice speed when retrieving my objects? ...

How long should a DataContext live?

Hi, I was just wondering how long should a DataContext really live. All the patterns and practices books like Dino Esposito's Microsoft .NET: Architecting Applications for the Enterprise tell you, datacontext must not live long, nor should it be cached. But how long is the right time? A whole web request, a unit of work, a transaction, ...