本文整理汇总了C#中System.Security.PermissionSet.Demand方法的典型用法代码示例。如果您正苦于以下问题:C# System.Security.PermissionSet.Demand方法的具体用法?C# System.Security.PermissionSet.Demand怎么用?C# System.Security.PermissionSet.Demand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.PermissionSet
的用法示例。
在下文中一共展示了System.Security.PermissionSet.Demand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnlistDistributedTransactionHelper
// NOTE: This is just a private helper because OracleClient V1.1 shipped
// with a different argument name and it's a breaking change to not use
// the same argument names in V2.0 (VB Named Parameter Binding--Ick)
private void EnlistDistributedTransactionHelper(System.EnterpriseServices.ITransaction transaction) {
System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
permissionSet.AddPermission(CONNECTIONOBJECTNAME.ExecutePermission); // MDAC 81476
permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode));
permissionSet.Demand();
Bid.Trace( "<prov.DbConnectionHelper.EnlistDistributedTransactionHelper|RES|TRAN> %d#, Connection enlisting in a transaction.\n", ObjectID);
SysTx.Transaction indigoTransaction = null;
if (null != transaction) {
indigoTransaction = SysTx.TransactionInterop.GetTransactionFromDtcTransaction((SysTx.IDtcTransaction)transaction);
}
RepairInnerConnection();
// NOTE: since transaction enlistment involves round trips to the
// server, we don't want to lock here, we'll handle the race conditions
// elsewhere.
InnerConnection.EnlistTransaction(indigoTransaction);
// NOTE: If this outer connection were to be GC'd while we're
// enlisting, the pooler would attempt to reclaim the inner connection
// while we're attempting to enlist; not sure how likely that is but
// we should consider a GC.KeepAlive(this) here.
GC.KeepAlive(this);
}