public T WithKey <T>(int id) where T : DomainObject { Object @object = this.objectRepository.WithKey(id); DomainObjectBuilder <T> objectBuilder = new DomainObjectBuilder <T>(); new ObjectDirector(this.requestHandler).ConstructObject(objectBuilder, @object); return(objectBuilder.Build()); }
public IEnumerable <T> All <T>() where T : DomainObject { Class @class = this.classRepository.WithCode(typeof(T).Name); IEnumerable <Object> objects = this.objectRepository.FilteredByClassId(@class.Id); ObjectDirector objectDirector = new ObjectDirector(this.requestHandler); return(objects.Select( o => { DomainObjectBuilder <T> objectBuilder = new DomainObjectBuilder <T>(); objectDirector.ConstructObject(objectBuilder, o); return objectBuilder.Build(); } )); }