public StatefullAggregateRepository(AggregateStore store, IDataFactory dataFactory, ISerializer serializer, AggregateRegistry aggregateRegistry, ITransitionStore transitionStore, AggregateDefinition definition)
     : base(store, dataFactory, definition)
 {
     _serializer = serializer;
     _aggregateRegistry = aggregateRegistry;
     _transitionStore = transitionStore;
 }
        public AggregateDefinition Register(Type aggregateType)
        {
            AggregateDefinition definition = new AggregateDefinition();
            definition.AggregateType = aggregateType;

            var aggregateAttribute = ReflectionUtils.GetSingleAttribute<AggregateAttribute>(aggregateType);
            definition.AggregateName = aggregateAttribute != null 
                ? aggregateAttribute.AggregateName 
                : aggregateType.FullName;

            var statefull = aggregateType.GetInterface(typeof(IStatefullAggregate).FullName);
            if (statefull != null)
            {
                definition.AggregateKind = AggregateKind.Statefull;

                if (aggregateType.BaseType == null
                    || aggregateType.BaseType.IsGenericType == false
                    || aggregateType.BaseType.GetGenericTypeDefinition() != typeof(StatefullAggregate<>))
                    throw new Exception(String.Format("We cannot find state type for [{0}] aggregate", aggregateType.FullName));

                var genericArgs = aggregateType.BaseType.GetGenericArguments();
                definition.StateType = genericArgs[0];
                return definition;
            }

            var stateless = aggregateType.GetInterface(typeof(IStatelessAggregate).FullName);
            if (stateless != null)
            {
                definition.AggregateKind = AggregateKind.Stateless;
                return definition;
            }

            throw new Exception(String.Format("Object of type ({0}) not an aggregate", aggregateType));
        }
 /// <summary>
 /// Constructs AggregateRepositoryBase
 /// </summary>
 protected AggregateRepositoryBase(AggregateStore store, IDataFactory dataFactory, AggregateDefinition definition)
 {
     _store = store;
     _dataFactory = dataFactory;
     _definition = definition;
 }
 public StatelessAggregateRepository(AggregateStore store, IDataFactory dataFactory, AggregateDefinition aggregateDefinition) : base(store, dataFactory, aggregateDefinition)
 {
 }