public void AttachObject(object obj) { var entityMap = ContextMap.EntityMaps.SingleOrDefault(q => q.EntityType == obj.GetType()); if (entityMap == null) { throw new Exception("Object type " + obj.GetType().ToString() + " is not supported by context"); } ObjectTracker.AttachObject(obj); }