Skip to content

Instantly share code, notes, and snippets.

@btshft
Created March 4, 2020 14:23
Show Gist options
  • Save btshft/f19641ff8c6f45800784bd620d104379 to your computer and use it in GitHub Desktop.
Save btshft/f19641ff8c6f45800784bd620d104379 to your computer and use it in GitHub Desktop.
SomeGist
public interface IBuilder<T> where T : PurchaseDocuments
{
Entity Build(T dto);
}
public abstract class BuilderBase<T> : IBuilder<T> where T : PurchaseDocuments
{
public Entity Build(T dto)
{
var entity = new Entity();
var purchaser = GetPurchaser(dto);
return entity;
}
protected abstract PurchaserInfo GetPurchaser(T dto);
}
public class ConcreteBuilder : BuilderBase<EokCancellation>
{
/// <inheritdoc />
protected override PurchaserInfo GetPurchaser(EokCancellation dto)
{
return dto.Purchaser;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment