本文整理汇总了C#中CommandType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CommandType.ToString方法的具体用法?C# CommandType.ToString怎么用?C# CommandType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandType
的用法示例。
在下文中一共展示了CommandType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotSupportedCommandType
static internal ArgumentOutOfRangeException NotSupportedCommandType(CommandType value) {
#if DEBUG
switch(value) {
case CommandType.Text:
case CommandType.StoredProcedure:
Debug.Assert(false, "valid CommandType " + value.ToString());
break;
case CommandType.TableDirect:
break;
default:
Debug.Assert(false, "invalid CommandType " + value.ToString());
break;
}
#endif
return ODBC.NotSupportedEnumerationValue(typeof(CommandType), (int)value);
}
示例2: AddUnidentifiedWordsToCommandText
/// <summary>
/// This method will compare the command type and append unidnetified words to the respective text file
/// </summary>
/// <param name="commandType">identified command type</param>
public static void AddUnidentifiedWordsToCommandText(CommandType commandType)
{
try
{
var testFiles = FileManager.GetTestFiles();
var textFile = "";
// get the text file by first removing the file extension, and it's checking whether it's ending
// with the provided command type
foreach (
var testFile in
testFiles.Where(
testFile =>
testFile.Remove(testFile.IndexOf(VbwFileManager.FileExtension(), StringComparison.Ordinal))
.EndsWith(commandType.ToString())))
{
// if so, set that particular testFile as the file name
textFile = testFile;
}
// assign the unidentified words to the test file
DataManager.AppendToFile(textFile, UnIdentifiedWords);
}
catch (Exception ex)
{
Log.ErrorLog(ex);
throw;
}
}
示例3: DeriveParametersNotSupported
internal static InvalidOperationException DeriveParametersNotSupported(Type type, CommandType commandType)
{
var args = new[] {type.ToString(), commandType.ToString()};
return
new InvalidOperationException(
GetExceptionMessage(
"{0} DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{1}.", args));
}
示例4: SendCommand
public static void SendCommand(CommandType command, string[] args)
{
if (!PipeClient.IsConnected()) return;
List<string> argsToSend = new List<string> { command.ToString() };
argsToSend.AddRange(args);
PipeClient.SendMessage(string.Join(MessageSeparator.ToString(), argsToSend));
}
示例5: Test2
public string Test2(CommandType cmdType)
{
string msg = "CommandType:" + cmdType.ToString();
IContextProperty prop = System.Runtime.Remoting.Contexts.Context.DefaultContext.GetProperty("UserData") as IContextProperty;
if (null != prop)
msg += prop.ToString();
msg += "线程ID:" + System.Threading.Thread.CurrentThread.ManagedThreadId + " ";
Log.Dac(msg);
return "收到" + msg;
}
示例6: EventPayloadIndentifier
public EventPayloadIndentifier(byte[] payload, int commitSequence, DataProviderCommandSource dataProvider,
CommandType commandType, Type type)
{
Payload = payload;
CommitSequence = commitSequence;
DataProvider = dataProvider.ToString();
DataProviderId = (int) dataProvider;
CommandType = commandType.ToString();
CommandTypeId = (int) commandType;
Type = type;
}
示例7: WrapAndPublish
public void WrapAndPublish(ICommand command, CommandType commandType)
{
var message = new BusMessage
{
CommandType = commandType.ToString(),
MessageId = command.CommandId,
BodyJson = JsonConvert.SerializeObject(command, new IsoDateTimeConverter()),
SendDateTime = "" //use default
};
Publish(message);
}
示例8: GetReferenceSetCommand
public IReferenceSetCommand GetReferenceSetCommand(CommandType commandType, UserContext userContext, ResourceProperty property, EntityMetadata entityMetadata, string membershipId, ResourceType resourceType)
{
Envelope<PSRunspace, UserContext> envelope = this.runspaceStore.Borrow(userContext, membershipId);
PSReferenceSetCmdletInfo item = null;
try
{
item = ((PSEntityMetadata)entityMetadata).CmdletsForReferenceSets[property.Name].Cmdlets[commandType];
}
catch (KeyNotFoundException keyNotFoundException)
{
Tracer tracer = new Tracer();
tracer.DebugMessage(string.Concat("GetCommand cannot find commandType: ", commandType.ToString()));
object[] fullName = new object[3];
fullName[0] = property.ResourceType.FullName;
fullName[1] = property.Name;
fullName[2] = commandType.ToString();
string str = string.Format(CultureInfo.CurrentCulture, Resources.PropertyDoesNotHaveCommand, fullName);
throw new InvalidOperationException(str);
}
return new PSReferenceCommand(envelope, resourceType, item);
}
示例9: GetCommand
public ICommand GetCommand(CommandType commandType, UserContext userContext, ResourceType entityType, EntityMetadata entityMetadata, string membershipId)
{
Envelope<PSRunspace, UserContext> envelope = this.runspaceStore.Borrow(userContext, membershipId);
PSEntityMetadata pSEntityMetadatum = entityMetadata as PSEntityMetadata;
object[] assemblyQualifiedName = new object[3];
assemblyQualifiedName[0] = "entityMetadata";
assemblyQualifiedName[1] = entityMetadata.GetType().AssemblyQualifiedName;
assemblyQualifiedName[2] = typeof(PSEntityMetadata).AssemblyQualifiedName;
ExceptionHelpers.ThrowArgumentExceptionIf("entityMetadata", pSEntityMetadatum == null, Resources.InvalidArgClrType, assemblyQualifiedName);
object[] name = new object[2];
name[0] = entityType.Name;
name[1] = commandType.ToString();
ExceptionHelpers.ThrowArgumentExceptionIf("entityMetadata", !pSEntityMetadatum.Cmdlets.ContainsKey(commandType), Resources.EntityDoesNotHaveCommand, name);
return new PSCommand(envelope, entityType, pSEntityMetadatum.Cmdlets[commandType], commandType);
}
示例10: AddCmdlet
public void AddCmdlet(CommandType commandType, string cmdletName)
{
try
{
this.Cmdlets.Add(commandType, new PSCmdletInfo(cmdletName));
}
catch (ArgumentException argumentException1)
{
ArgumentException argumentException = argumentException1;
object[] str = new object[1];
str[0] = commandType.ToString();
string str1 = string.Format(CultureInfo.CurrentCulture, Resources.DuplicateCommandInEntityMetadata, str);
throw new InvalidSchemaException(str1, argumentException);
}
}
示例11: GetStringCommand
//
// Constructs a string representation of a command without the \r\n
//
public static string GetStringCommand(CommandType commandType, string key, long size, long ttl)
{
string result = commandType.ToString() + " " + key;
if (commandType == CommandType.SET || commandType == CommandType.VALUE) {
result += " " + size.ToString() ;
}
if (commandType == CommandType.SET) {
result += " " + ttl.ToString();
}
return result;
}
示例12: ControlAppPool
public static string ControlAppPool(string appPoolName, CommandType command, string username, string pwd)
{
string appPoolPath = Constants.AddressHeader + Constants.AppPools + "/" + appPoolName;
try
{
using (DirectoryEntry appPoolEntry = username == null ? new DirectoryEntry(appPoolPath) : new DirectoryEntry(appPoolPath, username, pwd, AuthenticationTypes.Secure))
{
appPoolEntry.Invoke(command.ToString(), null);
appPoolEntry.Close();
return Constants.Success;
}
}
catch(Exception e)
{
return e.Message;
}
}
示例13: TypeToString
public static string TypeToString(CommandType type) {
switch (type) {
case CommandType.None:
return "None";
case CommandType.Group:
return "Group";
case CommandType.UIMove:
return "Move";
case CommandType.UIDelete:
return "Delete";
case CommandType.UIRename:
return "Rename";
case CommandType.IOMove:
return "Move";
case CommandType.IODelete:
return "Delete";
case CommandType.IORename:
return "Rename";
default:
return type.ToString();
}
}
示例14: ExecuteReader
/// <summary>
/// 执行查询命令,返回DataReader对象
/// </summary>
/// <param name="ConnectionString">连接字符串</param>
/// <param name="Database">默认数据库名</param>
/// <param name="CommandType">命令类型</param>
/// <param name="CommandTimeout">命令超时时间</param>
/// <param name="SqlText">sql命令</param>
/// <param name="SqlParms">sql命令参数</param>
/// <returns></returns>
private static SqlDataReader ExecuteReader(string ConnectionString, CommandType CommandType, int CommandTimeout, string SqlText, params SqlParameter[] SqlParms)
{
SqlCommand dc = new SqlCommand();
SqlConnection conn = new SqlConnection(ConnectionString);
try
{
PrepareCommand(dc, conn, CommandType, CommandTimeout, null, SqlText, SqlParms);
//执行命令
SqlDataReader dr = dc.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}
catch (Exception ex)
{
conn.Close();
StringBuilder sb = new StringBuilder();
sb.Append(ex.ToString());
//sb.Append("\r\n");
//sb.Append("ConnectionString: ");
//sb.Append(ConnectionString);
sb.Append("\r\n");
sb.Append("Database: ");
sb.Append(conn.Database);
sb.Append("\r\n");
sb.Append("CommandType: ");
sb.Append(CommandType.ToString());
sb.Append("\r\n");
sb.Append("CommandTimeout: ");
sb.Append(dc.CommandTimeout.ToString());
sb.Append("\r\n");
sb.Append("CommandText: ");
sb.Append(dc.CommandText);
sb.Append("\r\n");
if (SqlParms != null && SqlParms.Length > 0)
{
sb.Append("SqlParameters: ");
sb.Append("\r\n");
foreach (SqlParameter parm in SqlParms)
{
sb.Append(parm.ParameterName);
sb.Append("=");
sb.Append(Convert.ToString(parm.Value));
sb.Append("\r\n");
}
sb.Append("\r\n");
}
//throw new DBException("系统提示错误:"+ex.Message+sb.ToString());
throw new Exception("系统提示错误:" + ex.Message);
}
}
示例15: ExecuteQueryDT
/// <summary>
/// 执行查询命令,返回DataTable
/// </summary>
/// <param name="ConnectionString">连接字符串</param>
/// <param name="Database">默认数据库名</param>
/// <param name="CommandType">命令类型</param>
/// <param name="CommandTimeout">命令超时时间</param>
/// <param name="SqlText">sql命令</param>
/// <param name="SqlParms">sql命令参数</param>
/// <returns></returns>
private static DataTable ExecuteQueryDT(string ConnectionString, CommandType CommandType, int CommandTimeout, string SqlText, params SqlParameter[] SqlParms)
{
SqlCommand dc = new SqlCommand();
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
try
{
PrepareCommand(dc, conn, CommandType, CommandTimeout, null, SqlText, SqlParms);
//执行命令
SqlDataAdapter da = new SqlDataAdapter(dc);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
catch (Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.Append(ex.ToString());
//sb.Append("\r\n");
//sb.Append("ConnectionString: ");
//sb.Append(ConnectionString);
sb.Append("\r\n");
sb.Append("Database: ");
sb.Append(conn.Database);
sb.Append("\r\n");
sb.Append("CommandType: ");
sb.Append(CommandType.ToString());
sb.Append("\r\n");
sb.Append("CommandTimeout: ");
sb.Append(dc.CommandTimeout.ToString());
sb.Append("\r\n");
sb.Append("CommandText: ");
sb.Append(dc.CommandText);
sb.Append("\r\n");
if (SqlParms != null && SqlParms.Length > 0)
{
sb.Append("SqlParameters: ");
sb.Append("\r\n");
foreach (SqlParameter parm in SqlParms)
{
sb.Append(parm.ParameterName);
sb.Append("=");
sb.Append(Convert.ToString(parm.Value));
sb.Append("\r\n");
}
sb.Append("\r\n");
}
throw new Exception(sb.ToString());
}
}
}