/// <summary> /// Assembly Temporary Table Name /// </summary> public virtual void AssemblyTemporaryTableNameAndPrimaryKey() { AssemblyFormatLineContent(); if (!FormatLineText.StartsWith(keyF, StringComparison.CurrentCultureIgnoreCase)) { throw new ExceptionOwnerEx(LineNo); } int firstBrackets = FormatLineText.IndexOf("{"); if (firstBrackets <= 0) { throw new ExceptionOwnerEx(LineNo); } string _tempName = FormatLineText.Substring(keyF.Length + 1, firstBrackets - (keyF.Length + 1)).Replace("#", "").Trim(); if (string.IsNullOrEmpty(_tempName)) { throw new ExceptionOwnerEx(LineNo); } else if (_tempName.Contains(" ")) { throw new ExceptionOwnerEx(LineNo); } TemporaryName = _tempName; TemporaryNameFlag = true; }
/// <summary> /// 生成索引动作代理 /// </summary> public override void GenerateIndex() { base.GenerateIndex(); AssemblyFormatLineContent(); if (!FormatLineTextToLower.StartsWith("create nonclustered index", StringComparison.CurrentCultureIgnoreCase) && !FormatLineTextToLower.StartsWith("create unique nonclustered index", StringComparison.CurrentCultureIgnoreCase)) { throw new ExceptionOwnerEx(LineNo); } if (!FormatLineTextToLower.Contains(" on ")) { throw new ExceptionOwnerEx(LineNo); } string _tempContent = UtilsOwnerEx.GetBracketBetweenContent(FormatLineText, LineNo); string indexName = string.Empty; indexName = "\""; if (_tempContent.IndexOf(",") > 0) { string[] names = _tempContent.Split(','); for (int i = 0; i < names.Length; i++) { if (i == names.Length - 1) { indexName += names[i].Trim(); } else { indexName += names[i].Trim() + ","; } } } else { indexName += _tempContent.Trim(); } indexName += "\""; GenerateNotes(IndexBuilder); IndexBuilder.AppendLine(" DatabaseIndexAttribute idx0" + Indexer + " = new DatabaseIndexAttribute(" + indexName + ");"); if (FormatLineText.IndexOf(" unique ", StringComparison.CurrentCultureIgnoreCase) > 0) { IndexBuilder.AppendLine(" idx0" + Indexer + ".Unique = true;"); } IndexBuilder.AppendLine(" idx0" + Indexer + ".Name = \"IDX" + TemporaryName.Replace('_', '0') + Indexer + "\";"); IndexerNames += ", idx0" + Indexer; Indexer++; }
/// <summary> /// 解析属性值动作代理 /// </summary> /// <param name="lineTextContent"></param> public virtual void AssemblyPropertyValue(string lineTextContent) { string _tempLineTextContent = FormatLineText; if (!string.IsNullOrEmpty(lineTextContent)) { _tempLineTextContent = lineTextContent; } if (string.IsNullOrEmpty(FormatLineText)) { throw new ExceptionOwnerEx(LineNo); } string[] valueArray = FormatLineText.Split(' '); if (valueArray.Length > 4 || valueArray.Length <= 1) { throw new ExceptionOwnerEx(LineNo); } PropertyName = valueArray[0]; if (valueArray.Length == 4) { TempTypeNameContent = valueArray[1]; TempDefaultValueContent = valueArray[2]; TempNotesContent = valueArray[3]; } else if (valueArray.Length == 3) { string tempValule = valueArray[1]; if (tempValule.StartsWith("def_", StringComparison.CurrentCultureIgnoreCase)) { TempDefaultValueContent = tempValule; TempTypeNameContent = string.Empty; } else { TempDefaultValueContent = string.Empty; TempTypeNameContent = tempValule; } TempNotesContent = valueArray[2]; } else if (valueArray.Length == 2) { TempTypeNameContent = valueArray[1]; } }
public override void AssemblyTemporaryTableNameAndPrimaryKey() { base.AssemblyTemporaryTableNameAndPrimaryKey(); int bracket = FormatLineText.IndexOf("{") + 1; if (bracket <= 1) { throw new ExceptionOwnerEx(LineNo); } OrgPrimaryKeyLineContent = OrgLineText.Substring(OrgLineText.IndexOf("{") + 1).TrimStart(); string tempText = FormatLineText.Substring(bracket).Trim(); if (!string.IsNullOrEmpty(tempText)) { FormatLineText = tempText; RecodePrimaryKeyContent(); AssemblyManager(); } }