static SnapshotRegistration() { if (!BsonClassMap.IsClassMapRegistered(typeof(EventUnfolderMemento))) { var cma = new SnapshotClassMap(typeof(EventUnfolderMemento)); BsonClassMap.RegisterClassMap <EventUnfolderMemento>(); } }
public static void AutomapAggregateState(Assembly assembly) { var stateTypes = assembly.GetTypes() .Where(x => typeof(AggregateState).IsAssignableFrom(x) && x.IsClass && !x.IsAbstract); // automap dello stato foreach (var state in stateTypes) { var st = typeof(AggregateSnapshot <>).MakeGenericType(new[] { state }); if (!BsonClassMap.IsClassMapRegistered(st)) { var cma = new SnapshotClassMap(st); BsonClassMap.RegisterClassMap(cma); } } }