// @devnote: should be multithread safe access to OleDbConnection.idataInitialize, // though last one wins for setting variable. It may be different objects, but // OLE DB will ensure I'll work with just the single pool static private OleDbServicesWrapper GetObjectPool() { OleDbServicesWrapper wrapper = OleDbConnectionInternal.idataInitialize; if (null == wrapper) { lock (dataInitializeLock) { wrapper = OleDbConnectionInternal.idataInitialize; if (null == wrapper) { VersionCheck(); object datalinks; try { datalinks = CreateInstanceDataLinks(); } catch (Exception e) { // UNDONE - should not be catching all exceptions!!! if (!ADP.IsCatchableExceptionType(e)) { throw; } throw ODB.MDACNotAvailable(e); } if (null == datalinks) { throw ODB.MDACNotAvailable(null); } wrapper = new OleDbServicesWrapper(datalinks); OleDbConnectionInternal.idataInitialize = wrapper; } } } Debug.Assert(null != wrapper, "GetObjectPool: null dataInitialize"); return(wrapper); }
private static OleDbServicesWrapper GetObjectPool() { OleDbServicesWrapper idataInitialize = OleDbConnectionInternal.idataInitialize; if (idataInitialize == null) { lock (dataInitializeLock) { object obj2; idataInitialize = OleDbConnectionInternal.idataInitialize; if (idataInitialize != null) { return(idataInitialize); } VersionCheck(); try { obj2 = CreateInstanceDataLinks(); } catch (Exception exception) { if (!ADP.IsCatchableExceptionType(exception)) { throw; } throw ODB.MDACNotAvailable(exception); } if (obj2 == null) { throw ODB.MDACNotAvailable(null); } idataInitialize = new OleDbServicesWrapper(obj2); OleDbConnectionInternal.idataInitialize = idataInitialize; } } return(idataInitialize); }