public IShardedEntityRegistryBuilder WithShardedEntity <T, C, E, S>() where T : ShardedEntity <C, E, S>, new() where C : AbstractCommand where E : AbstractEvent where S : AbstractState { RegistryDelegates.Add( y => y.Register <T, C, E, S>() ); return(this); }
/// <summary> /// Register without DI /// </summary> /// <param name="entityFactory"></param> /// <typeparam name="T"></typeparam> /// <typeparam name="C"></typeparam> /// <typeparam name="E"></typeparam> /// <typeparam name="S"></typeparam> /// <returns></returns> public IShardedEntityRegistryBuilder WithShardedEntity <T, C, E, S>(Func <T> entityFactory = null) where T : ShardedEntity <C, E, S> where C : AbstractCommand where E : AbstractEvent where S : AbstractState { RegistryDelegates.Add( (x, y) => y.Register <T, C, E, S>( () => { if (entityFactory == null) { return(Activator.CreateInstance <T>()); } return(entityFactory.Invoke()); } ) ); return(this); }