@@ -540,45 +540,30 @@ private static bool AreEqual(byte[] a1, byte[] a2)
540
540
541
541
private IPublicClientApplication CreateClientAppInstance ( PublicClientAppKey publicClientAppKey )
542
542
{
543
- IPublicClientApplication publicClientApplication ;
544
-
545
- #if NETSTANDARD
546
- if ( _parentActivityOrWindowFunc != null )
547
- {
548
- publicClientApplication = PublicClientApplicationBuilder . Create ( publicClientAppKey . _applicationClientId )
549
- . WithAuthority ( publicClientAppKey . _authority )
550
- . WithClientName ( Common . DbConnectionStringDefaults . ApplicationName )
551
- . WithClientVersion ( Common . ADP . GetAssemblyVersion ( ) . ToString ( ) )
552
- . WithRedirectUri ( publicClientAppKey . _redirectUri )
553
- . WithParentActivityOrWindow ( _parentActivityOrWindowFunc )
554
- . Build ( ) ;
555
- }
556
- #endif
557
- #if NETFRAMEWORK
558
- if ( _iWin32WindowFunc != null )
543
+ PublicClientApplicationBuilder builder = PublicClientApplicationBuilder
544
+ . CreateWithApplicationOptions ( new PublicClientApplicationOptions
545
+ {
546
+ ClientId = publicClientAppKey . _applicationClientId ,
547
+ ClientName = Common . DbConnectionStringDefaults . ApplicationName ,
548
+ ClientVersion = Common . ADP . GetAssemblyVersion ( ) . ToString ( ) ,
549
+ RedirectUri = publicClientAppKey . _redirectUri ,
550
+ } )
551
+ . WithAuthority ( publicClientAppKey . _authority ) ;
552
+
553
+ #if NETFRAMEWORK
554
+ if ( _iWin32WindowFunc is not null )
559
555
{
560
- publicClientApplication = PublicClientApplicationBuilder . Create ( publicClientAppKey . _applicationClientId )
561
- . WithAuthority ( publicClientAppKey . _authority )
562
- . WithClientName ( Common . DbConnectionStringDefaults . ApplicationName )
563
- . WithClientVersion ( Common . ADP . GetAssemblyVersion ( ) . ToString ( ) )
564
- . WithRedirectUri ( publicClientAppKey . _redirectUri )
565
- . WithParentActivityOrWindow ( _iWin32WindowFunc )
566
- . Build ( ) ;
556
+ builder . WithParentActivityOrWindow ( _iWin32WindowFunc ) ;
567
557
}
568
- #endif
569
- #if ! NETCOREAPP
570
- else
571
- #endif
558
+ #endif
559
+ #if NETSTANDARD
560
+ if ( _parentActivityOrWindowFunc is not null )
572
561
{
573
- publicClientApplication = PublicClientApplicationBuilder . Create ( publicClientAppKey . _applicationClientId )
574
- . WithAuthority ( publicClientAppKey . _authority )
575
- . WithClientName ( Common . DbConnectionStringDefaults . ApplicationName )
576
- . WithClientVersion ( Common . ADP . GetAssemblyVersion ( ) . ToString ( ) )
577
- . WithRedirectUri ( publicClientAppKey . _redirectUri )
578
- . Build ( ) ;
562
+ builder . WithParentActivityOrWindow ( _parentActivityOrWindowFunc ) ;
579
563
}
564
+ #endif
580
565
581
- return publicClientApplication ;
566
+ return builder . Build ( ) ;
582
567
}
583
568
584
569
private static TokenCredentialData CreateTokenCredentialInstance ( TokenCredentialKey tokenCredentialKey , string secret )
0 commit comments