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
// see Google Groups topic at https://groups.google.com/d/topic/lokad/kD53JYzkV0o/discussion | |
// example event handler in a projection | |
// _clients is an instance of IClientNotificationService | |
public void When(Source<NewAppointmentRegistered> source) | |
{ | |
NewAppointmentRegistered e = source.Event; | |
DateTime dateTime = e.DateTime.Date; | |
_writer.UpdateEnforcingNew(dateTime, dayDto => AddNewAppointmentToDayDto(dayDto, e.Id, ...)); |
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
internal class PublishingAtomicWriter<TKey, TEntity> : IAtomicWriter<TKey, TEntity> where TEntity : class | |
{ | |
private readonly IClientNotificationService _clients; | |
private readonly IAtomicWriter<TKey, TEntity> _writer; | |
private readonly Action<TKey, TEntity> _publishAction; | |
public PublishingAtomicWriter(IAtomicWriter<TKey, TEntity> writer, Action<TKey, TEntity> publishAction) | |
{ | |
if (publishAction == null) throw new ArgumentNullException("publishAction"); |
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 System; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Linq; | |
namespace FillEmptySpaceWithRectangles | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) |
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 HashCodeGenerator<T> | |
{ | |
private readonly List<Func<T, object>> _getters = new List<Func<T, object>>(); | |
public HashCodeGenerator() | |
{ | |
PropertyInfo[] properties = typeof(T).GetProperties(); | |
foreach (var p in properties) | |
{ |
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 DefaultEndpointConfig : IWantToRunBeforeConfiguration | |
{ | |
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | |
public void Init() | |
{ | |
SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure); | |
Configure.With().Log4Net() | |
.DefiningCommandsAs(type => !type.IsAbstract && !type.IsInterface && typeof(Base.Messages.ICommand).IsAssignableFrom(type)) | |
.DefiningEventsAs(type => !type.IsAbstract && !type.IsInterface && typeof(Base.Messages.IEvent).IsAssignableFrom(type)) |
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
[HttpPost] | |
public async Task<ActionResult> Edit(ApplicationDto model) | |
{ | |
if (ModelState.IsValid) | |
{ | |
AppErrorCodes errorCode = await | |
Bus.Send(new UpdateApplication | |
{ | |
Id = model.Id, | |
Name = model.Name, |