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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to