Last active
September 23, 2018 08:38
-
-
Save mehmetalierol/c161abd124f9625f9713f3a82307f7ba to your computer and use it in GitHub Desktop.
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 Company.Application.Common.Enums; | |
using System; | |
namespace Company.Application.Common.Data | |
{ | |
public class EntityBase | |
{ | |
/// <summary> | |
/// Tüm entitylerimizde bulunması gereken propertyleri bu base class ile tanımlıyoruz. | |
/// Bu sınıfımızı inherit alacak derived class'ımız dğrudan aşağıdaki propertylere sahip olacak ve biz tekrarlı kod yazmak zorunda kalmayacağız | |
/// Dto ve data arasındaki farklılık eminim dikkatinizi çekmiştir burada örnek olması açısından küçük bir business kod ekledim | |
/// Eğer bu sınıf türetildiğinde Id null ise default olarak yeni bir guid oluşturularak atanacak ve aynı şey createDate alanı içinde geçerli olacak | |
/// Data sınıfları business içerebilir ancak dto sınıfları sadece propertyler içermektedir, çünkü amaçları datayı taşımaktır. | |
/// Data ve dto arasındaki value transferlerini auto Mapper kullanarak yapacağız. | |
/// </summary> | |
private AppStatus status; | |
private DateTime createdDate; | |
public Guid Id { get; set; } | |
public DateTime? CreateDate | |
{ | |
get | |
{ | |
return createdDate; | |
} | |
set | |
{ | |
createdDate = value ?? DateTime.UtcNow; | |
} | |
} | |
public Guid? Creator { get; set; } | |
public AppStatus? Status | |
{ | |
get | |
{ | |
return status; | |
} | |
set | |
{ | |
status = value ?? AppStatus.Aktif; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment