Skip to content

Instantly share code, notes, and snippets.

Lev Gorodinski eulerfx

Block or report user

Report or block eulerfx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2087870
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
<title>Example Feed</title>
<subtitle>A subtitle.</subtitle>
<link href="" rel="self" />
<name>John Doe</name>
eulerfx / FuncRetryHelper.cs
Created Mar 22, 2012
Function retry logic
View FuncRetryHelper.cs
public static Func<T> Retry(Func<T> original, int retryCount)
return () =>
while (true)
return original();
eulerfx / TaskHelper.cs
Created Mar 22, 2012
TPL retry logic
View TaskHelper.cs
/// <summary>
/// Utility methods for <see cref="System.Threading.Tasks.Task"/>.
/// </summary>
public static class TaskHelper
/// <summary>
/// Returns a task which retries the task returned by the specified task provider.
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="taskProvider">The task returning function.</param>
eulerfx / PurchaseOrder.cs
Last active Aug 21, 2019
An example or a DDD application service.
View PurchaseOrder.cs
// A repository.
public interface IPurchaseOrderRepository
PurchaseOrder Get(string id);
// The commit method would likely be moved to a Unit of Work managed by infrastructure.
void Commit();
// A marker interface for a domain event.
public interface IDomainEvent { }
View Order.cs
public class Order
public string Id { get; private set; }
public string Number { get; private set; }
public string CustomerId { get; private set; }
public DateTime Date { get; private set; }
public ICollection<OrderLineItem> Items { get; private set; }
public decimal ShippingCharge { get; private set; }
public decimal TaxCharge { get; private set; }
public decimal Total
View IOrderRepository.cs
public interface IOrderRepository
Order Get(string Id);
IList<Order> GetMostRecent(string customerId, int max = 20);
void Add(Order order);
void Remove(string Id);
eulerfx / IOrderRepository.GetMostRecent.sql
Created Apr 26, 2012
IOrderRepository.GetMostRecent SQL
View IOrderRepository.GetMostRecent.sql
select top(@max)
Total = o.TaxCharge + o.ShippingCharge + (select sum(i.Amount * i.Quantity) from OrderLineItems i where i.OrderId = o.Id)
from Orders o
where o.CustomerId = @customerId
order by o.Date desc
View OrderReadModel.cs
public OrderReadModel
public string Id { get; private set; }
public string OrderNumber { get; private set; }
public DateTime Date { get; private set; }
public decimal Total { get; private set; }
eulerfx / UserProfile_AlwaysValid.cs
Created May 20, 2012
Always valid user profile
View UserProfile_AlwaysValid.cs
public class UserProfile
public UserProfile(string name)
this.Name = name;
public string Name
get { return _name; }
View UserProfile_ValidationDeferred.cs
public class UserProfile
public string Name { get; set; }
// implementation omitted
public bool IsValid { get; }
var profile = new UserProfile();
// must query to ascertain validity
if (!profile.IsValid)
You can’t perform that action at this time.