public string MakeXsd(TableInfoTS tableInfo) { string result = string.Empty; result += "<xs:complexType name=\"" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T\">" + Environment.NewLine; result += "\t<xs:sequence/>" + Environment.NewLine; foreach (ColumnInfoTS column in tableInfo.ColumnInfos) { if (!string.IsNullOrEmpty(column.SQLDataType)) { string xmlType = new StrConverter().GetXmlType(column.SQLDataType); result += "\t<xs:attribute name=\"" + new StrConverter().ChangeSnakeToCamel(column.ColumnName) + "\"\t\t\ttype=\"xs:" + xmlType + "\"/>" + Environment.NewLine; } } result += "</xs:complexType>"; return result; }
private string MakeDBEntityNamespaceAndClassText(string targetDomain, string yourName, TableInfoTS tableInfo) { string result = string.Empty; result += "namespace BoyzBe." + targetDomain + Environment.NewLine; result += "{" + Environment.NewLine; result += "\t/// <summary>" + Environment.NewLine; result += "\t/// " + tableInfo.TableName + " DB Entity Class" + Environment.NewLine; result += "\t/// </summary>" + Environment.NewLine; result += "\t/// <remarks>" + Environment.NewLine; result += "\t/// " + DateTime.Now.ToShortDateString() + " " + yourName + " " + "최초 작성" + Environment.NewLine; result += "\t/// </remarks>" + Environment.NewLine; result += "\tpublic class " + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T" + Environment.NewLine; result += "\t{" + Environment.NewLine; result += new StrConverter().MakeDbEntityMembers(tableInfo); result += "\t}" + Environment.NewLine; result += "}" + Environment.NewLine; return result; }
/// <summary> /// Dac의 주 클래스 텍스트 만듬 /// </summary> /// <param name="domain"></param> /// <param name="tableInfo"></param> /// <returns></returns> /// <remarks> /// 2015-07-03 양승빈 최초작성 /// </remarks> private string MakeDacNamespaceAndClassText(string domain, string yourName, TableInfoTS tableInfo) { string result = string.Empty; // 여기가 헤더라 생각 result += "namespace IAC." + domain + Environment.NewLine; result += "{" + Environment.NewLine; result += "\t/// <summary>" + Environment.NewLine; result += "\t/// " + tableInfo.TableName + " 테이블 Dac Class" + Environment.NewLine; result += "\t/// </summary>" + Environment.NewLine; result += "\t/// <remarks>" + Environment.NewLine; result += "\t/// " + DateTime.Now.ToShortDateString() + " " + yourName + " " + "최초 작성" + Environment.NewLine; result += "\t/// </remarks>" + Environment.NewLine; result += "\tpublic class " + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "Dac : DacBase" + Environment.NewLine; result += "\t{" + Environment.NewLine; // 데이터 추가 부분 - 아이덴티티 제외 해야함 result += "\t\t#region [C: 레코드 추가]" + Environment.NewLine; result += Environment.NewLine; result += "\t\tpublic void Insert(" + new StrConverter().MakeAddFunctionHeaderParam(tableInfo) + ")" + Environment.NewLine; result += "\t\t{" + Environment.NewLine; // maindb2ex만 일단 예외처리 if(tableInfo.DBName != "maindb2ex") result += "\t\t\tnew DacHelper(_dbHelper, \"" + tableInfo.DBName + "_write\").Execute(" + Environment.NewLine; else result += "\t\t\tnew DacHelper(_dbHelper, \"maindb2_write\").Execute(" + Environment.NewLine; result += "\t\t\t\tCommandType.StoredProcedure," + Environment.NewLine; // maindb2ex만 일단 예외처리 if (tableInfo.DBName != "maindb2ex") result += "\t\t\t\t\"dbo.UPIAC_" + domain + "_" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "_Insert\"," + Environment.NewLine; else result += "\t\t\t\t\"maindb2ex.dbo.UPIAC_" + domain + "_" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "_Insert\"," + Environment.NewLine; result += new StrConverter().MakeInsertFunctionCallParam(tableInfo) + Environment.NewLine; result += "\t\t\t);" + Environment.NewLine; result += "\t\t}" + Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += Environment.NewLine; // 데이터 조회 부분 - 키로만 조회 result += "\t\t#region [R: 레코드 조회]" + Environment.NewLine; result += Environment.NewLine; result += "\t\tpublic " + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T Select(" + new StrConverter().MakeGetFunctionHeaderParam(tableInfo) + ")" + Environment.NewLine; result += "\t\t{" + Environment.NewLine; result += "\t\t\treturn (" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T)new DacHelper(_dbHelper, \"" + tableInfo.DBName + "_read\").SelectSingleEntity(" + Environment.NewLine; result += "\t\t\t\ttypeof(" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T)," + Environment.NewLine; result += "\t\t\t\tDataMappingCache.GetDataMappings(\"" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T\")," + Environment.NewLine; result += "\t\t\t\tCommandType.StoredProcedure," + Environment.NewLine; result += "\t\t\t\t\"dbo.UPIAC_" + domain + "_" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "_Select\"," + Environment.NewLine; result += new StrConverter().MakeSelectFunctionCallParam(tableInfo) + Environment.NewLine; result += "\t\t\t);" + Environment.NewLine; result += "\t\t}" + Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += Environment.NewLine; // 여기가 풋터라 생각 result += "\t\t#region [U: 레코드 변경]" + Environment.NewLine; result += Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += Environment.NewLine; result += "\t\t#region [D: 레코드 삭제]" + Environment.NewLine; result += Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += "\t}" + Environment.NewLine; result += "}" + Environment.NewLine; return result; }
/// <summary> /// Dac의 주 클래스 텍스트 만듬 /// </summary> /// <param name="domain"></param> /// <param name="tableInfo"></param> /// <returns></returns> /// <remarks> /// 2015-07-03 양승빈 최초작성 /// </remarks> private string MakeBehaviorNamespaceAndClassText(string domain, string yourName, TableInfoTS tableInfo) { string result = string.Empty; // 여기가 헤더라 생각 result += "namespace BoyzBe." + domain + Environment.NewLine; result += "{" + Environment.NewLine; result += "\t/// <summary>" + Environment.NewLine; result += "\t/// " + tableInfo.TableName + " 테이블 Behavior Class" + Environment.NewLine; result += "\t/// </summary>" + Environment.NewLine; result += "\t/// <remarks>" + Environment.NewLine; result += "\t/// " + DateTime.Now.ToShortDateString() + " " + yourName + " " + "최초 작성" + Environment.NewLine; result += "\t/// </remarks>" + Environment.NewLine; result += "\tpublic class " + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "Behavior" + Environment.NewLine; result += "\t{" + Environment.NewLine; // 데이터 추가 부분 - 아이덴티티 제외 해야함 result += "\t\t#region [C: 레코드 추가]" + Environment.NewLine; result += Environment.NewLine; result += "\t\tpublic void Insert(" + new StrConverter().MakeAddFunctionHeaderParam(tableInfo) + ")" + Environment.NewLine; result += "\t\t{" + Environment.NewLine; result += "\t\t\tDataAccessor.Execute(" + Environment.NewLine; result += "\t\t\t\t\"" + tableInfo.DBName + "_write\"," + Environment.NewLine; result += "\t\t\t\tCommandType.StoredProcedure," + Environment.NewLine; result += "\t\t\t\t\"dbo.BOYZBE_" + domain + "_" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "_Insert\"," + Environment.NewLine; result += new StrConverter().MakeInsertFunctionCallParam(tableInfo) + Environment.NewLine; result += "\t\t\t);" + Environment.NewLine; result += "\t\t}" + Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += Environment.NewLine; // 데이터 조회 부분 - 키로만 조회 result += "\t\t#region [R: 레코드 조회]" + Environment.NewLine; result += Environment.NewLine; result += "\t\tpublic " + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T Select(" + new StrConverter().MakeGetFunctionHeaderParam(tableInfo) + ")" + Environment.NewLine; result += "\t\t{" + Environment.NewLine; result += "\t\t\treturn " + "DataAccessor.SelectSingleEntity<" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "T>(" + Environment.NewLine; result += "\t\t\t\t\"" + tableInfo.DBName + "_read\"," + Environment.NewLine; result += "\t\t\t\tCommandType.StoredProcedure," + Environment.NewLine; result += "\t\t\t\t\"dbo.BOYZBE_" + domain + "_" + new StrConverter().ChangeSnakeToCamel(tableInfo.TableName) + "_Select\"," + Environment.NewLine; result += new StrConverter().MakeSelectFunctionCallParam(tableInfo) + Environment.NewLine; result += "\t\t\t);" + Environment.NewLine; result += "\t\t}" + Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += Environment.NewLine; // 여기가 풋터라 생각 result += "\t\t#region [U: 레코드 변경]" + Environment.NewLine; result += Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += Environment.NewLine; result += "\t\t#region [D: 레코드 삭제]" + Environment.NewLine; result += Environment.NewLine; result += "\t\t#endregion" + Environment.NewLine; result += "\t}" + Environment.NewLine; result += "}" + Environment.NewLine; return result; }