Skip to content

Commit fafc19a

Browse files
committed
Simpler code.
1 parent ec697c8 commit fafc19a

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
using System.Diagnostics;
2323
using System.IO;
2424
using System.Reflection;
25-
#if NETSTANDARD1_6
26-
using Microsoft.Extensions.PlatformAbstractions;
27-
#endif
2825
using FirebirdSql.Data.Common;
2926
#if !NETSTANDARD1_6
3027
using FirebirdSql.Data.Schema;
@@ -467,9 +464,7 @@ private string GetProcessName()
467464

468465
private string GetHostingPath()
469466
{
470-
#if NETSTANDARD1_6
471-
return PlatformServices.Default.Application.ApplicationBasePath;
472-
#elif NETSTANDARD2_0
467+
#if NETSTANDARD1_6 || NETSTANDARD2_0
473468
return System.AppContext.BaseDirectory;
474469
#else
475470
Assembly assembly;
@@ -497,18 +492,19 @@ private string GetHostingPath()
497492
}
498493
private string GetRealProcessName()
499494
{
500-
var assembly = Assembly.GetEntryAssembly();
501-
return assembly?.Location ?? Process.GetCurrentProcess().MainModule.FileName;
495+
return Assembly.GetEntryAssembly()?.Location ?? Process.GetCurrentProcess().MainModule.FileName;
502496
}
503497

504498
private int GetProcessId()
505499
{
506-
#if !NETSTANDARD1_6
507-
var assembly = Assembly.GetEntryAssembly();
508-
if (!(assembly?.IsFullyTrusted) ?? false)
500+
try
501+
{
502+
return Process.GetCurrentProcess().Id;
503+
}
504+
catch (InvalidOperationException)
505+
{
509506
return -1;
510-
#endif
511-
return Process.GetCurrentProcess().Id;
507+
}
512508
}
513509

514510
private void EnsureActiveTransaction()

0 commit comments

Comments
 (0)