Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Melhorias de design do código #9

Open
rscouto opened this issue Jan 29, 2016 · 0 comments
Open

Melhorias de design do código #9

rscouto opened this issue Jan 29, 2016 · 0 comments

Comments

@rscouto
Copy link
Contributor

rscouto commented Jan 29, 2016

O objetivo desta issue é trazer mais testabilidade com as seguintes alterações:

  • Extrair interface de ApiResource.
  • APIs passam a ser compostas por uma interface IApiResource
  • Remove herança de ApiResource

Ex:

// Atualmente 
public class Customer : APIResource
{
    public Customer()
    {
        BaseURI += "/customers";
    }
}

// Depois 
public class Customer : IDisposable
{
    private readonly IApiResource _client;

    public Customer(IApiResourceclient) : this()
    {
        _client = client;
    }

    protected Customer()
    {
        _client = _client ?? new ApiResource();
        _client.BaseURI += "/customers";
    }

    public void Dispose()
    {
        _client.Dispose();
        GC.SuppressFinalize(this);
    }
}
@rscouto rscouto modified the milestone: Versão 1.5 do Client Feb 4, 2016
@rscouto rscouto removed this from the Versão 1.5 do Client milestone Jun 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant