public static void AddBlog(this IServiceCollection services, ITeclynApiConfiguration configuration) { services.AddTeclyn(new TeclynApi(configuration) .AddDomain <UserDomain>(d => d .AddCommand <RegisterUserCommand, RegisterUserCommandHandler>() .AddAggregate <IUser>(a => a .AddEvent <Registered>())) .AddDomain <PostDomain>(d => d .AddCommand <CreatePostAsDraft, CreatePostAsDraftCommandHandler>() .AddCommand <PublishPost, PublishPostCommandHandler>() .AddCommand <UpdatePostText, UpdatePostTextCommandHandler>() .AddCommand <UpdatePostTitle, UpdatePostTitleCommandHandler>() .AddQuery <ListPosts, ListPostsQueryHandler, IEnumerable <IPost> >() .AddAggregate <IPost>(a => a .AddEvent <CreatedAsDraft>() .AddEvent <Published>() .AddEvent <TextUpdated>() .AddEvent <TitleUpdated>()))); }
public TeclynApi(ITeclynApiConfiguration _) { this.Configuration = _; }
public static void AddSample(this IServiceCollection services, ITeclynApiConfiguration configuration) { services.AddTeclyn(new TeclynApi(configuration)); }