From: Gareth <gar...@gm...> - 2009-02-28 16:09:10
|
How about this method for initializing the process name, I don't know if a static field / property / method in FbConnectionInternal is unfavourable or not. This should work as there is only one process. The "processName" field will be initialized when required and will not need to be initialized for the life of the process. In BuildDpb dpb.Append(IscCodes.isc_dpb_process_name, ProcessName); static string processName; private static string ProcessName { get { return processName ?? (processName = GetProcessName()); } } private static string GetProcessName() { #if (NET_CF) // for CF we can implement GetModuleFileName from coredll #else try { return Process.GetCurrentProcess().MainModule.FileName; } catch(System.ComponentModel.Win32Exception) { try { return AppDomain.CurrentDomain.FriendlyName; } catch { } } #endif return String.Empty; } -- Gareth |