/// <summary> /// クラスのインスタンス作成時に実行されるコンストラクタ /// </summary> public ProgramService() { var sql = new SQLStrings(); sql.AppendLine("SELECT"); sql.AppendLine(" PROGRAM_ID,"); sql.AppendLine(" PROGRAM_NM,"); sql.AppendLine(" ASSEMBLY_NM"); sql.AppendLine("FROM"); sql.AppendLine(" M_PROGRAM"); sql.AppendLine("WHERE"); sql.AppendLine(" ASSEMBLY_NM = :ASSEMBLY_NM"); var exeName = Process.GetCurrentProcess().MainModule?.ModuleName; var param = new { ASSEMBLY_NM = exeName }; // TODO //var ret = Database.Select(sql, param); //if (ret.Count == 0) //{ // return; //} //var first = ret.FirstOrDefault(); //this.ProgramID = first.PROGRAM_ID; //this.ProgramName = first.PROGRAM_NM; //this.AssemblyName = first.ASSEMBLY_NM; }
/// <summary> /// クラスへの初回アクセス時に1度だけ実行される静的コンストラクタ /// </summary> static LoggerService() { _SQL = new SQLStrings(); _SQL.AppendLine("INSERT INTO"); _SQL.AppendLine(" T_LOG"); _SQL.AppendLine("("); _SQL.AppendLine(" SEQ,"); _SQL.AppendLine(" LOG_KBN,"); _SQL.AppendLine(" CLASS_NM,"); _SQL.AppendLine(" METHOD_NM,"); _SQL.AppendLine(" MESSAGE,"); _SQL.AppendLine(" INS_DATE,"); _SQL.AppendLine(" INS_TIME,"); _SQL.AppendLine(" INS_PROGRAM_ID,"); _SQL.AppendLine(" INS_USER_NM,"); _SQL.AppendLine(" INS_TERM_NM,"); _SQL.AppendLine(" UPD_DATE,"); _SQL.AppendLine(" UPD_TIME,"); _SQL.AppendLine(" UPD_PROGRAM_ID,"); _SQL.AppendLine(" UPD_USER_NM,"); _SQL.AppendLine(" UPD_TERM_NM"); _SQL.AppendLine(")"); _SQL.AppendLine("VALUES"); _SQL.AppendLine("("); _SQL.AppendLine(" T_LOG_SEQ.NEXTVAL,"); _SQL.AppendLine(" :LOG_KBN,"); _SQL.AppendLine(" :CLASS_NM,"); _SQL.AppendLine(" :METHOD_NM,"); _SQL.AppendLine(" :MESSAGE,"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDD'),"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'HH24MISS'),"); _SQL.AppendLine(" :PROGRAM_ID,"); _SQL.AppendLine(" :USER_NM,"); _SQL.AppendLine(" :TERM_NM,"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDD'),"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'HH24MISS'),"); _SQL.AppendLine(" :PROGRAM_ID,"); _SQL.AppendLine(" :USER_NM,"); _SQL.AppendLine(" :TERM_NM"); _SQL.AppendLine(")"); }