/// <summary> /// Initializes a new instance of the <see cref="DataServiceController{TKey, TAggregateRoot}"/> class. /// </summary> /// <param name="repositoryContext">The repository context that is used for initializing the data service controller.</param> /// <param name="keyGenerator">The key generator which is used for generating the aggregate root key. /// If the persistence mechanism will generate the key automatically, for example, in SQL Server databases, an auto increment /// value is used for the key column, the <see cref="NullKeyGenerator{TKey}"/> can be used for this parameter.</param> /// <param name="queryConditionParser">The query condition parser which parses a given query string into a lambda expression.</param> /// <param name="sortSpecificationParser">The sort specification parser which parses a given sort specification string /// into a lambda expression.</param> public DataServiceController(IRepositoryContext repositoryContext, IKeyGenerator <TKey, TAggregateRoot> keyGenerator, IQueryConditionParser queryConditionParser, ISortSpecificationParser sortSpecificationParser) { this.repositoryContext = repositoryContext; this.repository = repositoryContext.GetRepository <TKey, TAggregateRoot>(); this.keyGenerator = keyGenerator; this.queryConditionParser = queryConditionParser; this.sortSpecificationParser = sortSpecificationParser; }
/// <summary> /// Initializes a new instance of the <see cref="DataServiceController{TKey, TAggregateRoot}"/> class. /// </summary> /// <param name="repositoryContext">The repository context that is used for initializing the data service controller.</param> /// <param name="queryConditionParser">The query condition parser which parses a given query string into a lambda expression.</param> /// <param name="sortSpecificationParser">The sort specification parser which parses a given sort specification string /// into a lambda expression.</param> public DataServiceController(IRepositoryContext repositoryContext, IQueryConditionParser queryConditionParser, ISortSpecificationParser sortSpecificationParser) : this(repositoryContext, new NullKeyGenerator <TKey>(), queryConditionParser, sortSpecificationParser) { }