public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { LogEntity logEntity = data as LogEntity; string deccript = (logEntity == null) ?source : CommonExtension.StringFormat("{0}-{1}" , string.IsNullOrEmpty(logEntity.Category) ? source : logEntity.Category , (logEntity.MessageList.Count > 0) ? logEntity.MessageList[0].Content : "" ); if (logEntity == null) { base.TraceData(eventCache, deccript, eventType, id, data); } else { int size = logEntity.MessageList.Count; object[] msgs = new object[size + 1]; for (int i = 0; i < size; i++) { LogMessage msg = logEntity.MessageList[i]; string msgString = CommonExtension.StringFormat("[{0}] {1}", msg.TimestampXml, msg.Content); msgs.SetValue(msgString, i); } // this.TraceOutputOptions msgs.SetValue(logEntity.ExtInfo(), size); base.TraceData(eventCache, deccript, eventType, id, msgs); } }
static public string AutoGenKey(ref EntityRow row) { var table = row.Table; if (table == null) { return(null); } var pk = row.Table.PrimaryKey; var keyGen = pk.GetAttributesEntity().KeyGen; if (string.IsNullOrEmpty(keyGen)) { return(null); } var tableAttri = table.GetAttributesEntity(); long keyIndex = tableAttri.KeyCount + 1; var key = CommonExtension.StringFormat(keyGen, keyIndex); tableAttri.KeyCount = keyIndex; row.SetValue(table.PrimaryKey, key, true); return(key); //Table.GetAttributesEntity().KeyCount }
static private string GetFilePath(string file) { if (file.Contains("\\")) { return(file); } return(CommonExtension.StringFormat("{0}\\{1}", SystemSetting.Instance.StorageDirectory, file)); }
private ActivityTrace CreateActivity(string name) { ActivityTrace activityTrace = new ActivityTrace(CreateTraceSource(), false) { Name = name }; if (string.IsNullOrEmpty(name)) { activityTrace.Name = CommonExtension.StringFormat ( "{0}.{1}:activity{2}" , Process.GetCurrentProcess().Id , Thread.CurrentThread.ManagedThreadId , activityTrace.GetHashCode() ); } activityTrace.Start(); return(activityTrace); }
static public Regex GenSideReplaceRegex(string leftSideSymbol, string rightSideSymbol) { var trimSide = CommonExtension.StringFormat(trimSideSymbolDef, leftSideSymbol, rightSideSymbol); return(new Regex(trimSide)); }
public Exception(string message, params object[] args) : base(CommonExtension.StringFormat(message, args)) { ErrorInfo.AppendedMessage = base.Message; }
private Regex GenRegex(string key) { string matchString = CommonExtension.StringFormat("(({1}|^){0}=)([^{1}{2}]{{0,}})", key, separatorSymbol, pairSymbol); return(new Regex(matchString)); }
public bool ContainRow(string filterExpression, params object[] parameters) { string expression = CommonExtension.StringFormat(filterExpression, parameters); return(Table.Select(expression).Length != 0); }