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

Named client configuration is bugged #51

Open
dotdiego opened this issue Jul 8, 2021 · 1 comment
Open

Named client configuration is bugged #51

dotdiego opened this issue Jul 8, 2021 · 1 comment

Comments

@dotdiego
Copy link

dotdiego commented Jul 8, 2021

Hello,

My issue is based on this : https://docs.microsoft.com/en-us/odata/client/using-extensions#named-clients

We can create a custom client in Startup.cs

services.AddODataClient("TripPin")
    .ConfigureODataClient(dsc =>
    {
        dsc.BaseUri = new Uri("https://services.odata.org/v4/(S(lqbvtwide0ngdev54adgc0lu))/TripPinServiceRW/");

        // Github API versioning
        dsc.Configurations.Properties.Add("User-Agent", "ODataClientFactory-Sample"));
    });

But there are no way to create a client with only a Name property.
Constructors available are taking as parameters :
Uri serviceRoot, string name
Uri serviceRoot

We are missing an empty constructor and a constructor that takes only a Name to find related configuration.
ServiceRoot should not be mandatory in this constructor.

    [EnableQuery]
    public IEnumerable<Person> Get()
    {
        var client = _clientFactory.CreateClient<DefaultContainer>("TripPin"); << This doesn't exists
        var people = client.People.Execute();
        return people;
    }
@RobertStigsson
Copy link

Do we have any update on this?

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

2 participants