These are chat archives for Ruhrpottpatriot/GW2.NET

9th
Aug 2016
Robert Logiewa
@Ruhrpottpatriot
Aug 09 2016 10:29
Yeah, I gave up on moving models into the other libraries. But now I have another idea
Darnell Williams
@Seeker1437
Aug 09 2016 12:27
Care to share?
Robert Logiewa
@Ruhrpottpatriot
Aug 09 2016 12:29
Of course we want to offer caching to the user. Currently the cache implementation simply takes the items returned from the api and stores them.
But while I was working on it, I saw that the cache is really nothing more than another repository with just another data back end.
As you might know, I changed the repositories from a full blown implementation, where every repository had the query logic built in, to extension methods.
This means, a repository in core just looks like this now:


        /// <inheritdoc />
        public CultureInfo Culture { get; set; }


        /// <inheritdoc />
        public IConverter<int, int> IdentifiersConverter { get; }

        /// <inheritdoc />
        public IConverter<ItemDataModel, Item> ModelConverter { get; }

        /// <inheritdoc />
        public IParameterizedBuilder ServiceLocation
        {
            get
            {
                return ApiMessageBuilder.Init().Version(ApiVersion.V2).OnEndpoint("items");
            }
        }
The problem I was facing was that the base class of the repository relied on the HttpClient to make connections.
If I was to treat a cache as another repository I need to decouple both.
Darnell Williams
@Seeker1437
Aug 09 2016 12:34
Ah I see :O
Robert Logiewa
@Ruhrpottpatriot
Aug 09 2016 12:34
This also removes another problem. Currently the cache only works on endpoints which offer the "standard" endpoint scheme (i.e. a query against v2/items returns ids which you can query further).
So I introduced anotehr interface IConnector, which just offers one method currently Query and has a QueryBuilder property.
The QueryBuilder property offers a fluent interface to build query messages, which then can be used be the IConnector to query the data source.
Darnell Williams
@Seeker1437
Aug 09 2016 12:54
Wow okay I