我正试图找到"打破非公开方法"的解决方案.
我只是想调用RuntimeMethodInfo.InternalGetCurrentMethod(...)
,传递我自己的参数(所以我可以实现GetCallingMethod()
),或直接RuntimeMethodInfo.InternatGetCurrentMethod(ref StackCrawlMark.LookForMyCaller)
在我的日志记录例程中使用.GetCurrentMethod
实施方式如下:
[MethodImpl(MethodImplOptions.NoInlining)]
public static MethodBase GetCurrentMethod()
{
StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
return RuntimeMethodInfo.InternalGetCurrentMethod(ref lookForMyCaller);
}
Run Code Online (Sandbox Code Playgroud)
InternalGetCurrentMethod
声明在哪里:内部:-).
我使用反射调用方法没有问题,但这会弄乱调用堆栈,这只是必须要保留的一件事,否则它会破坏它的目的.
我的堆栈跟踪保持接近原始的几率是多少(至少在允许的StackCrawlMark
s 的距离内,这是LookForMe
,LookForMyCaller
和LookForMyCallersCaller
.是否有一些复杂的方法来实现我想要的?
仅使用基于密码的身份验证,即可在CSOM中轻松进行身份验证:
context.Credentials = new SharePointOnlineCredentials(username, password);
Run Code Online (Sandbox Code Playgroud)
但是,当进行多因素身份验证时(http://technet.microsoft.com/zh-cn/library/dn249471.aspx),如何进行身份验证?
我在插入和选择之间遇到死锁问题
连接 A:
连接 B:
因此,当 A 插入(步骤 1)并且 B 使用索引(步骤 1)时,似乎发生了死锁。连接 A 和 B 都使用 ROWLOCK 提示。
有没有办法为连接 B 指定 MyTable_Index 不应该被锁定,就像一个表的 NOLOCK,但现在是索引?
或者其他一些聪明的技巧(除了删除索引或使用聚集索引)?
期待一些聪明的解决方案:-)
我试图理解Powershell,但发现事情并不那么直观.我理解的是,在管道中传递对象,而不是传统的文本.并且$ _指的是管道中的当前对象.那么,为什么以下不起作用:
get-date|Write-Host "$_"
Run Code Online (Sandbox Code Playgroud)
错误消息是:
Write-Host:输入对象不能绑定到命令的任何参数,因为该命令不接受管道输入或输入及其属性不会影响任何接受管道输入的参数.在行:1 char:10 + get-date | Write-Host $ _ + ~~~~~~~~~~~~~ + CategoryInfo:InvalidArgument:(10-9-2014 15:17:00:PSObject) [Write-Host],ParameterBindingException + FullyQualifiedErrorId:InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
c# ×1
csom ×1
deadlock ×1
locking ×1
methods ×1
powershell ×1
private ×1
reflection ×1
sql-server ×1