This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dapper; | |
using Oracle.ManagedDataAccess.Client; | |
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Linq; | |
public class OracleDynamicParameters : Dapper.SqlMapper.IDynamicParameters { | |
private static Dictionary<SqlMapper.Identity, Action<IDbCommand, object>> paramReaderCache = new Dictionary<SqlMapper.Identity, Action<IDbCommand, object>>( ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string TruncateString(this string value, int maxLength) | |
{ | |
int valueLength = value.Length; | |
const string CHARACTER_REPLACE = "..."; | |
int startPosition = (maxLength / 3); | |
if(valueLength > maxLength) | |
{ | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ConditionalExtensions | |
{ | |
/// <summary> | |
/// Unification ternary operation | |
/// </summary> | |
/// <typeparam name="T">in type</typeparam> | |
/// <typeparam name="V">out type</typeparam> | |
/// <param name="baseObject">this object</param> | |
/// <param name="exp">boolean expression</param> | |
/// <param name="firstValue">true value</param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var phone = "+77771112233" | |
var record = GetRecordById(Id); | |
new RulePrototypeConcrete() | |
.With(new ChangePhoneRule(phone)) | |
.With(new DeletePhoneRule(phone)) | |
.With(new ExistsPhoneRule(phone)) | |
.Execute(record); | |
public abstract class RulePrototype : IDisposable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Config setting | |
<configuration> | |
<system.diagnostics> | |
<sources> | |
<source name="System.ServiceModel.MessageLogging"> | |
<listeners> | |
<add name="xml" /> | |
</listeners> | |
</source> | |
</sources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
j.name AS job_name | |
,ja.start_execution_date | |
,ISNULL(last_executed_step_id, 0) + 1 AS current_executed_step_id | |
,js.step_name | |
,ja.session_id | |
,js.command | |
,js.last_run_duration | |
,ja.job_id | |
FROM msdb.dbo.sysjobactivity ja |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT cast(TextData AS XML) | |
,DatabaseName | |
,TransactionID | |
,HostName | |
,ApplicationName | |
,LoginName | |
,SPID | |
,Duration | |
,StartTime | |
,EndTime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region MEF dll example | |
namespace MEF | |
{ | |
public interface ICore | |
{ | |
String PerformOperations(string data, string command); | |
string Operation(string data, IOperation oper); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Format placeholder in string | |
/// </summary> | |
public static class StringExtension | |
{ | |
public static string FormatPlaceholder(this string inString, params string[] param) | |
{ | |
int placeholderCounter = 0; | |
string[] placeholder = new string[param.Length]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var log = new LogScope()) | |
{ | |
try | |
{ | |
var tM = new TestModel | |
{ |
OlderNewer