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
namespace Multiton.Pattern | |
{ | |
public sealed class Sample | |
{ | |
static Dictionary<string, Sample> _instances = new Dictionary<string, Sample>(); | |
// the key type of dictionary collection can be int,string etc. | |
static object _lock = new object(); | |
private Sample() |
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 class DomesticPaymentRepository | |
: BaseRepository<Payment> | |
{ | |
} | |
public class ForeignPaymentRepository | |
:BaseRepository<Payment> | |
{ |
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> | |
/// implementor | |
/// </summary> | |
public interface IFormatter | |
{ | |
} | |
/// <summary> | |
/// concrete implementor |
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 interface IContextFactory | |
{ | |
SampleContext GetContext(); | |
} | |
public class ContextFactory | |
:IContextFactory,IDisposable | |
{ | |
private SampleContext _sampleContext; |
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
// Repository Pattern | |
public interface IRepository<TObject> | |
{ | |
IQueryable<TObject> All(); | |
IQueryable<TObject> Filter(Expression<Func<TObject, bool>> predicate); | |
IQueryable<TObject> Filter<Key>(Expression<Func<TObject, bool>> filter, | |
out int total, int index = 0, int size = 50); | |
bool Contains(Expression<Func<TObject, bool>> predicate); | |
TObject Find(params object[] keys); | |
TObject Find(Expression<Func<TObject, bool>> predicate); |
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 Unit Of Work Pattern | |
public interface IUnitOfWork | |
{ | |
void Commit(); | |
} | |
/// <summary> | |
/// Universal Repository de diyebiliriz | |
/// </summary> | |
public class UnitOfWork |
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 abstract class StaffBase | |
{ | |
public abstract string IdentityNumber { get; set; } | |
public abstract string FullName { get; set; } | |
public abstract string Department { get; set; } | |
public abstract int EfficiencyScore(); | |
public abstract Dictionary<int, string> TaskStatus(); | |
#region Null Implementation |
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 abstract class BaseEntity | |
{ | |
// Default identity(key) for Each Object | |
public int Id { get; set; } | |
// Basic properties | |
public DateTime CreateDate { get; set; } | |
public DateTime UpdateDate{ get; set; } | |
public bool IsActive { get; set; } | |
} |
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 abstract class Message { } | |
public class BaseReponseMessage | |
:Message | |
{ | |
} | |
public class BaseRequestMessage | |
:Message | |
{ |
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 class BaseMessage | |
{ | |
Guid moduleReference; | |
public Guid ModuleReference | |
{ | |
get { return moduleReference; } | |
set { moduleReference = value; } | |
} | |
int processReference; |
OlderNewer