本文整理汇总了C#中ExecuteType类的典型用法代码示例。如果您正苦于以下问题:C# ExecuteType类的具体用法?C# ExecuteType怎么用?C# ExecuteType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecuteType类属于命名空间,在下文中一共展示了ExecuteType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteStartImpl
/// <summary>
/// Tracks when 'command' is started.
/// </summary>
public void ExecuteStartImpl(DbCommand command, ExecuteType type)
{
var id = Tuple.Create((object)command, type);
var sqlTiming = new SqlTiming(command, type, Profiler);
_inProgress[id] = sqlTiming;
}
示例2:
void IDbProfiler.ExecuteFinish(DbCommand profiledDbCommand, ExecuteType executeType, System.Data.Common.DbDataReader reader)
{
if (reader == null)
{
watch.Stop();
}
ExecuteFinishCount++;
}
示例3: ExecuteStartImpl
/// <summary>
/// Tracks when 'command' is started.
/// </summary>
public Guid ExecuteStartImpl(string collectionName, object query, ExecuteType type)
{
var id = Guid.NewGuid();
var mongoTiming = new MongoTiming(collectionName, query.ToString(), type, Profiler);
_inProgress[id] = mongoTiming;
return id;
}
示例4: ExecuteCommand
public static string ExecuteCommand( string ConnectionTypeName, string ConnectionString, string ConnectionStringName, string SqlCommand, ExecuteType ExecuteType )
{
string connstr = GetConnectionString( ConnectionString, ConnectionStringName );
IDbConnection conn = CreateConnection( ConnectionTypeName );
conn.ConnectionString = connstr;
string result = RunCommand( conn, SqlCommand, ExecuteType );
return result;
}
示例5: PriorityToIndex
public static int PriorityToIndex(ExecuteType priority)
{
switch (priority)
{
case ExecuteType.Implicit: return 0;
case ExecuteType.ImplicitIfUnique: return 1;
case ExecuteType.Explicit: return 2;
default: return 0;
}
}
示例6: GetCom
public static ExecuteCom GetCom(ExecuteType _type)
{
switch (_type)
{
case ExecuteType.Damage:
case ExecuteType.Cure:
case ExecuteType.Buffer:
break;
}
return null;
}
示例7: ExecuteFinishImpl
/// <summary>
/// Finishes profiling for 'command', recording durations.
/// </summary>
public void ExecuteFinishImpl(DbCommand command, ExecuteType type, DbDataReader reader = null)
{
var id = Tuple.Create((object)command, type);
var current = _inProgress[id];
current.ExecutionComplete(isReader: reader != null);
SqlTiming ignore;
_inProgress.TryRemove(id, out ignore);
if (reader != null)
{
_inProgressReaders[reader] = current;
}
}
示例8: ProfilerItem
/// <summary>
/// Creates a new SqlTiming to profile 'command'.
/// </summary>
public ProfilerItem(DbCommand command, ExecuteType executeType)
{
CommandText = AddSpacesToParameters(command.CommandText);
Parameters = GetCommandParameters(command);
ExecuteType = executeType;
if (Profiler.ConfigurationSettings.StackTraceBreadCrumbConfiguration.IsEnabled)
StackTraceBreadCrumb = GetStackTraceBreadCrumbs();
StartDateTime = DateTime.Now;
_totalStopWatch = Stopwatch.StartNew();
}
示例9: AddMongoTiming
public static void AddMongoTiming(string commandString, long durationMilliseconds, ExecuteType executeType)
{
if (MiniProfiler.Current == null || MiniProfiler.Current.Head == null)
return;
MiniProfiler.Current.Head.AddCustomTiming(MongoMiniProfiler.CategoryName,
new CustomTiming(MiniProfiler.Current, commandString)
{
DurationMilliseconds = durationMilliseconds,
FirstFetchDurationMilliseconds = durationMilliseconds,
ExecuteType = executeType.ToString().ToLower()
});
}
示例10: SqlTiming
/// <summary>
/// Creates a new SqlTiming to profile 'command'.
/// </summary>
public SqlTiming(DbCommand command, ExecuteType type, MiniProfiler profiler)
{
Id = Guid.NewGuid();
RawCommandString = CommandString = AddSpacesToParameters(command.CommandText);
Parameters = GetCommandParameters(command);
ExecuteType = type;
if (!MiniProfiler.Settings.ExcludeStackTraceSnippetFromSqlTimings)
StackTraceSnippet = Helpers.StackTraceSnippet.Get();
_profiler = profiler;
_profiler.AddSqlTiming(this);
_startTicks = _profiler.ElapsedTicks;
StartMilliseconds = MiniProfiler.GetRoundedMilliseconds(_startTicks);
}
示例11: SqlTiming
public SqlTiming(string commandText, ExecuteType type, MiniProfiler profiler)
{
Id = Guid.NewGuid();
CommandString = AddSpacesToParameters(commandText);
Parameters = new List<SqlTimingParameter>();
ExecuteType = type;
if (!MiniProfiler.Settings.ExcludeStackTraceSnippetFromSqlTimings)
StackTraceSnippet = Helpers.StackTraceSnippet.Get();
_profiler = profiler;
if (_profiler != null)
{
_profiler.AddSqlTiming(this);
_startTicks = _profiler.ElapsedTicks;
StartMilliseconds = _profiler.GetRoundedMilliseconds(_startTicks);
}
}
示例12: MongoTiming
/// <summary>
/// Creates a new SqlTiming to profile 'command'.
/// </summary>
public MongoTiming(string collectionName, string command, ExecuteType type, MiniProfiler profiler)
{
Id = Guid.NewGuid();
CollectionName = collectionName;
CommandString = command;
ExecuteType = type;
if (!MiniProfiler.Settings.ExcludeStackTraceSnippetFromSqlTimings)
StackTraceSnippet = Helpers.StackTraceSnippet.Get();
_profiler = profiler;
if (_profiler != null)
{
_profiler.AddMongoTiming(this);
_startTicks = _profiler.ElapsedTicks;
StartMilliseconds = _profiler.GetRoundedMilliseconds(_startTicks);
}
}
示例13: Execute
public object Execute(
TransactionChoice connType
, CommandType commandType
, string procedure
, ExecuteType executeType
, IList<SqlParameter> parameters
, out ExecuteOutcome executeOutcome, out string executeOutcomeMessage)
{
object result = null;
SqlCommand cmd = NewSqlCommand(connType, commandType, procedure, parameters);
try
{
result = CommandExecute(executeType, cmd);
executeOutcome = ExecuteOutcome.Success;
executeOutcomeMessage = "";
}
catch (Exception ex)
{
if (ex.GetBaseException().Message.Contains("timeout") || ex.GetBaseException().Message.Contains("deadlock"))
{
//return message that it timed out
executeOutcome = ExecuteOutcome.Timeout;
executeOutcomeMessage = "Server timed out or thread deadlock victim. "
+ ex.Message;
}
else
{
executeOutcome = ExecuteOutcome.Failure;
throw ex;
}
}
return result;
}
示例14:
void IDbProfiler.OnError(DbCommand profiledDbCommand, ExecuteType executeType, Exception exception)
{
// TODO: implement errors aggregation and presentation
}
示例15: GetExecutedCount
/// <summary>
/// Returns the number of sql statements of <paramref name="type"/> that were executed in this <see cref="Timing"/>.
/// </summary>
internal int GetExecutedCount(ExecuteType type)
{
return HasSqlTimings ? SqlTimings.Count(s => s.ExecuteType == type) : 0;
}