File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Provider/src/FirebirdSql.EntityFrameworkCore.Firebird/Extensions Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System . Reflection ;
2
+ using FirebirdSql . EntityFrameworkCore . Firebird . Infrastructure . Internal ;
3
+ using Microsoft . EntityFrameworkCore ;
4
+ using Microsoft . EntityFrameworkCore . Infrastructure ;
5
+
6
+ namespace FirebirdSql . EntityFrameworkCore . Firebird . Extensions
7
+ {
8
+ using System ;
9
+
10
+ /// <summary>
11
+ /// FirebirdSQL specific extension methods for <see cref="DatabaseFacade"/>.
12
+ /// </summary>
13
+ public static class FbDatabaseFacadeExtensions
14
+ {
15
+ /// <summary>
16
+ /// <para>
17
+ /// Returns true if the database provider currently in use is the FirebirdSQL provider.
18
+ /// </para>
19
+ /// <para>
20
+ /// This method can only be used after the <see cref="DbContext" /> has been configured because
21
+ /// it is only then that the provider is known. This means that this method cannot be used
22
+ /// in <see cref="DbContext.OnConfiguring" /> because this is where application code sets the
23
+ /// provider to use as part of configuring the context.
24
+ /// </para>
25
+ /// </summary>
26
+ /// <param name="database">
27
+ /// The facade from <see cref="DbContext.Database" />.
28
+ /// </param>
29
+ /// <returns>
30
+ /// True if FirebirdSQL is being used; false otherwise.
31
+ /// </returns>
32
+ public static bool IsFirebird ( this DatabaseFacade database )
33
+ => database . ProviderName . Equals ( typeof ( FbOptionsExtension ) . GetTypeInfo ( ) . Assembly . GetName ( ) . Name , StringComparison . Ordinal ) ;
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments