本文整理汇总了C#中System.Data.SqlClient.SNIHandle类的典型用法代码示例。如果您正苦于以下问题:C# SNIHandle类的具体用法?C# SNIHandle怎么用?C# SNIHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SNIHandle类属于System.Data.SqlClient命名空间,在下文中一共展示了SNIHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BestEffortCleanup
internal static void BestEffortCleanup(SNIHandle target)
{
if (target != null)
{
target.Dispose();
}
}
示例2: SNIHandle
internal SNIHandle(SNINativeMethodWrapper.ConsumerInfo myInfo, string serverName, SNIHandle parent) : base(IntPtr.Zero, true)
{
this._status = uint.MaxValue;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
}
finally
{
this._status = SNINativeMethodWrapper.SNIOpen(myInfo, serverName, parent, ref this.handle, parent._fSync);
}
}
示例3: TdsParserStateObject
internal TdsParserStateObject(TdsParser parser, SNIHandle physicalConnection, bool async)
{
this._objectID = Interlocked.Increment(ref _objectTypeCount);
this._owner = new WeakReference(null);
this._inputHeaderLen = 8;
this._outputHeaderLen = 8;
this._outBytesUsed = 8;
this._outputPacketNumber = 1;
this._bTmp = new byte[12];
this._parser = parser;
this.SniContext = System.Data.SqlClient.SniContext.Snix_GetMarsSession;
this.SetPacketSize(this._parser._physicalStateObj._outBuff.Length);
SNINativeMethodWrapper.ConsumerInfo myInfo = this.CreateConsumerInfo(async);
this._sessionHandle = new SNIHandle(myInfo, "session:", physicalConnection);
if (this._sessionHandle.Status != 0)
{
parser.Errors.Add(parser.ProcessSNIError(this));
parser.ThrowExceptionAndWarning();
}
this.IncrementPendingCallbacks();
}
示例4: SNIWritePacket
internal static uint SNIWritePacket(SNIHandle pConn, SNIPacket packet, bool sync)
{
if (sync)
{
return SNIWriteSyncOverAsync(pConn, packet);
}
else
{
return SNIWriteAsyncWrapper(pConn, packet);
}
}
示例5: SNISecGenClientContext
internal static unsafe uint SNISecGenClientContext(SNIHandle pConnectionObject, byte[] inBuff, uint receivedLength, byte[] OutBuff, ref uint sendLength, byte[] serverUserName)
{
fixed (byte* pin_serverUserName = &serverUserName[0])
{
bool local_fDone;
return SNISecGenClientContextWrapper(
pConnectionObject,
inBuff,
receivedLength,
OutBuff,
ref sendLength,
out local_fDone,
pin_serverUserName,
(uint)(serverUserName == null ? 0 : serverUserName.Length),
null,
null);
}
}
示例6: SNIOpenMarsSession
public static uint SNIOpenMarsSession (ConsumerInfo info, SNIHandle parent, ref IntPtr handle, bool sync)
{
throw new NotSupportedException (msg);
}
示例7: CreatePhysicalSNIHandle
internal void CreatePhysicalSNIHandle(string serverName, bool ignoreSniOpenTimeout, long timerExpire, out byte[] instanceName, byte[] spnBuffer, bool flushCache, bool async, bool fParallel)
{
SNINativeMethodWrapper.ConsumerInfo myInfo = CreateConsumerInfo(async);
// Translate to SNI timeout values (Int32 milliseconds)
long timeout;
if (Int64.MaxValue == timerExpire)
{
timeout = Int32.MaxValue;
}
else
{
timeout = ADP.TimerRemainingMilliseconds(timerExpire);
if (timeout > Int32.MaxValue)
{
timeout = Int32.MaxValue;
}
else if (0 > timeout)
{
timeout = 0;
}
}
_sessionHandle = new SNIHandle(myInfo, serverName, spnBuffer, ignoreSniOpenTimeout, checked((int)timeout), out instanceName, flushCache, !async, fParallel);
}
示例8: TdsParserStateObject
internal TdsParserStateObject(TdsParser parser, SNIHandle physicalConnection, bool async)
{
// Construct a MARS session
Debug.Assert(null != parser, "no parser?");
_parser = parser;
SniContext = SniContext.Snix_GetMarsSession;
Debug.Assert(null != _parser._physicalStateObj, "no physical session?");
Debug.Assert(null != _parser._physicalStateObj._inBuff, "no in buffer?");
Debug.Assert(null != _parser._physicalStateObj._outBuff, "no out buffer?");
Debug.Assert(_parser._physicalStateObj._outBuff.Length ==
_parser._physicalStateObj._inBuff.Length, "Unexpected unequal buffers.");
// Determine packet size based on physical connection buffer lengths.
SetPacketSize(_parser._physicalStateObj._outBuff.Length);
SNINativeMethodWrapper.ConsumerInfo myInfo = CreateConsumerInfo(async);
_sessionHandle = new SNIHandle(myInfo, physicalConnection);
if (_sessionHandle.Status != TdsEnums.SNI_SUCCESS)
{
AddError(parser.ProcessSNIError(this));
ThrowExceptionAndWarning();
}
// we post a callback that represents the call to dispose; once the
// object is disposed, the next callback will cause the GC Handle to
// be released.
IncrementPendingCallbacks();
_lastSuccessfulIOTimer = parser._physicalStateObj._lastSuccessfulIOTimer;
}
示例9: SNIHandle
// constructs SNI Handle for MARS session
internal SNIHandle(SNINativeMethodWrapper.ConsumerInfo myInfo, SNIHandle parent) : base(IntPtr.Zero, true) {
RuntimeHelpers.PrepareConstrainedRegions();
try {} finally {
_status = SNINativeMethodWrapper.SNIOpenMarsSession(myInfo, parent, ref base.handle, parent._fSync);
}
}
示例10: SNIRemoveProvider
internal static extern uint SNIRemoveProvider(SNIHandle pConn, ProviderEnum ProvNum);
示例11: SNIReadSyncOverAsync
internal static extern uint SNIReadSyncOverAsync(SNIHandle pConn, ref IntPtr ppNewPacket, int timeout);
示例12: SNIReadAsync
internal static extern uint SNIReadAsync(SNIHandle pConn, ref IntPtr ppNewPacket);
示例13: SNIAddProvider
internal static extern uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo);
示例14: SNIHandle
// constructs SNI Handle for MARS session
internal SNIHandle(SNINativeMethodWrapper.ConsumerInfo myInfo, SNIHandle parent) : base(IntPtr.Zero, true)
{
try { }
finally
{
_status = SNINativeMethodWrapper.SNIOpenMarsSession(myInfo, parent, ref base.handle, parent._fSync);
}
}
示例15: SNIWriteAsync
private uint SNIWriteAsync(SNIHandle handle, SNIPacket packet, DbAsyncResult asyncResult)
{
uint num;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
}
finally
{
this.IncrementPendingCallbacks();
num = SNINativeMethodWrapper.SNIWriteAsync(handle, packet);
if ((num == 0) || (num != 0x3e5))
{
this.DecrementPendingCallbacks(false);
}
}
if (num != 0)
{
if (num != 0x3e5)
{
Bid.Trace("<sc.TdsParser.WritePacket|Info> write async returned error code %d\n", (int) num);
this._parser.Errors.Add(this._parser.ProcessSNIError(this));
this.ThrowExceptionAndWarning();
return num;
}
if (num != 0x3e5)
{
return num;
}
try
{
((IAsyncResult) asyncResult).AsyncWaitHandle.WaitOne();
if (this._error != null)
{
this._parser.Errors.Add(this._error);
this._error = null;
Bid.Trace("<sc.TdsParser.WritePacket|Info> write async returned error code %d\n", (int) num);
this.ThrowExceptionAndWarning();
}
}
finally
{
asyncResult.Reset();
}
}
return num;
}