OraclePermission.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / DataOracleClient / System / Data / OracleClient / OraclePermission.cs / 1 / OraclePermission.cs

                            //------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
namespace System.Data.OracleClient
{ 

    using System.Collections;
    using System.Data.Common;
    using System.Runtime.Serialization; 
    using System.Security;
    using System.Security.Permissions; 
 
    [Serializable]
    sealed public partial class OraclePermission :  CodeAccessPermission, IUnrestrictedPermission { 


        public OraclePermission(PermissionState state) {
            if (state == PermissionState.Unrestricted) { 
                _isUnrestricted = true;
            } 
            else if (state == PermissionState.None) { 
                _isUnrestricted = false;
            } 
            else {
                throw ADP.InvalidPermissionState(state);
            }
        } 

        private OraclePermission(OraclePermission permission) { // for Copy 
            if (null == permission) { 
                throw ADP.ArgumentNull("permissionAttribute");
            } 
            CopyFrom(permission);
        }

        internal OraclePermission(OraclePermissionAttribute permissionAttribute) { // for CreatePermission 
            if (null == permissionAttribute) {
                throw ADP.ArgumentNull("permissionAttribute"); 
            } 
            _isUnrestricted = permissionAttribute.Unrestricted;
            if (!_isUnrestricted) { 
                _allowBlankPassword = permissionAttribute.AllowBlankPassword;
                if (permissionAttribute.ShouldSerializeConnectionString() || permissionAttribute.ShouldSerializeKeyRestrictions()) { // MDAC 86773
                    Add(permissionAttribute.ConnectionString, permissionAttribute.KeyRestrictions, permissionAttribute.KeyRestrictionBehavior);
                } 
            }
        } 
 
        internal OraclePermission(OracleConnectionString connectionOptions) {
            if (null != connectionOptions) { 
                _allowBlankPassword = connectionOptions.HasBlankPassword; // MDAC 84563
                AddPermissionEntry(new DBConnectionString(connectionOptions));
            }
        } 

        public void Add(string connectionString, string restrictions, KeyRestrictionBehavior behavior) { 
            DBConnectionString constr = new DBConnectionString(connectionString, restrictions, behavior, OracleConnectionString.GetParseSynonyms(), false); 
            AddPermissionEntry(constr);
        } 

        override public IPermission Copy () {
            return new OraclePermission(this);
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
namespace System.Data.OracleClient
{ 

    using System.Collections;
    using System.Data.Common;
    using System.Runtime.Serialization; 
    using System.Security;
    using System.Security.Permissions; 
 
    [Serializable]
    sealed public partial class OraclePermission :  CodeAccessPermission, IUnrestrictedPermission { 


        public OraclePermission(PermissionState state) {
            if (state == PermissionState.Unrestricted) { 
                _isUnrestricted = true;
            } 
            else if (state == PermissionState.None) { 
                _isUnrestricted = false;
            } 
            else {
                throw ADP.InvalidPermissionState(state);
            }
        } 

        private OraclePermission(OraclePermission permission) { // for Copy 
            if (null == permission) { 
                throw ADP.ArgumentNull("permissionAttribute");
            } 
            CopyFrom(permission);
        }

        internal OraclePermission(OraclePermissionAttribute permissionAttribute) { // for CreatePermission 
            if (null == permissionAttribute) {
                throw ADP.ArgumentNull("permissionAttribute"); 
            } 
            _isUnrestricted = permissionAttribute.Unrestricted;
            if (!_isUnrestricted) { 
                _allowBlankPassword = permissionAttribute.AllowBlankPassword;
                if (permissionAttribute.ShouldSerializeConnectionString() || permissionAttribute.ShouldSerializeKeyRestrictions()) { // MDAC 86773
                    Add(permissionAttribute.ConnectionString, permissionAttribute.KeyRestrictions, permissionAttribute.KeyRestrictionBehavior);
                } 
            }
        } 
 
        internal OraclePermission(OracleConnectionString connectionOptions) {
            if (null != connectionOptions) { 
                _allowBlankPassword = connectionOptions.HasBlankPassword; // MDAC 84563
                AddPermissionEntry(new DBConnectionString(connectionOptions));
            }
        } 

        public void Add(string connectionString, string restrictions, KeyRestrictionBehavior behavior) { 
            DBConnectionString constr = new DBConnectionString(connectionString, restrictions, behavior, OracleConnectionString.GetParseSynonyms(), false); 
            AddPermissionEntry(constr);
        } 

        override public IPermission Copy () {
            return new OraclePermission(this);
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK