src/Microsoft.OpenApi.OData.Reader/Vocabulary/Authorization/Authorization.cs
/// <summary>
/// Create the corresponding Authorization object.
/// </summary>
/// <param name="record">The input record.</param>
/// <returns>The created <see cref="Authorization"/> object.</returns>
Create the corresponding Authorization object.
Create the corresponding Authorization object .
public static Authorization CreateAuthorization(IEdmRecordExpression record)
        {
            if (record == null || record.DeclaredType == null)
            {
                return null;
            }
            IEdmComplexType complexType = record.DeclaredType.Definition as IEdmComplexType;
            if (complexType == null)
            {
                return null;
            }
            Authorization auth;
            switch (complexType.FullTypeName())
            {
                case AuthorizationConstants.OpenIDConnect: 
                    auth = new OpenIDConnect();
                    break;
                case AuthorizationConstants.Http: 
                    auth = new Http();
                    break;
                case AuthorizationConstants.ApiKey: 
                    auth = new ApiKey();
                    break;
                case AuthorizationConstants.OAuth2ClientCredentials: 
                    auth = new OAuth2ClientCredentials();
                    break;
                case AuthorizationConstants.OAuth2Implicit: 
                    auth = new OAuth2Implicit();
                    break;
                case AuthorizationConstants.OAuth2Password: 
                    auth = new OAuth2Password();
                    break;
                case AuthorizationConstants.OAuth2AuthCode: 
                    auth = new OAuth2AuthCode();
                    break;
                case AuthorizationConstants.OAuthAuthorization: 
                default:
                    throw new OpenApiException(String.Format(SRResource.AuthorizationRecordTypeNameNotCorrect, complexType.FullTypeName()));
            }
            if (auth != null)
            {
                auth.Initialize(record);
            }
            return auth;
        }
public static Authorization CreateAuthorization ( IEdmRecordExpression record ) { if ( record == null || record . DeclaredType == null ) { return null ; } IEdmComplexType complexType = record . DeclaredType . Definition as IEdmComplexType ; if ( complexType == null ) { return null ; } Authorization auth ; switch ( complexType . FullTypeName ( ) ) { case AuthorizationConstants . OpenIDConnect : auth = new OpenIDConnect ( ) ; break ; case AuthorizationConstants . Http : auth = new Http ( ) ; break ; case AuthorizationConstants . ApiKey : auth = new ApiKey ( ) ; break ; case AuthorizationConstants . OAuth2ClientCredentials : auth = new OAuth2ClientCredentials ( ) ; break ; case AuthorizationConstants . OAuth2Implicit : auth = new OAuth2Implicit ( ) ; break ; case AuthorizationConstants . OAuth2Password : auth = new OAuth2Password ( ) ; break ; case AuthorizationConstants . OAuth2AuthCode : auth = new OAuth2AuthCode ( ) ; break ; case AuthorizationConstants . OAuthAuthorization : default : throw new OpenApiException ( String . Format ( SRResource . AuthorizationRecordTypeNameNotCorrect , complexType . FullTypeName ( ) ) ) ; } if ( auth != null ) { auth . Initialize ( record ) ; } return auth ; }
Create the corresponding Authorization object.
Create the corresponding Authorization object .
// OpenIDConnect // Http // ApiKey // OAuth2ClientCredentials // OAuth2Implicit // OAuth2Password // OAuth2AuthCode // OAuthAuthorization
The created  object.
The created object .
record
IEdmRecordExpression
The input record.
The input record .