Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Fix registration of MVC services #2648

Closed
kichalla opened this issue Jun 3, 2015 · 2 comments
Closed

Fix registration of MVC services #2648

kichalla opened this issue Jun 3, 2015 · 2 comments

Comments

@kichalla
Copy link
Member

kichalla commented Jun 3, 2015

Ideally both of the following configurations should work…i.e a user should be able to call ‘ConfigureMvc’ either before or after AddMvc() and all the options registered would get called in the sequence they were registered.
Currently the issue is that #2 does not work as AddMvc() call doesn’t add options if it was added earlier.

  1. public IServiceProvider ConfigureServices(IServiceCollection services)
    {
    services.AddMvc();

services.ConfigureMvc(options =>
{
// This adds both Input and Output formatters based on DataContractSerializer
options.AddXmlDataContractSerializerFormatter();

// To add XmlSerializer based Input and Output formatters.
options.InputFormatters.Add(new XmlSerializerInputFormatter());
options.OutputFormatters.Add(new XmlSerializerOutputFormatter());

});
2. public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.ConfigureMvc(options =>
{
// This adds both Input and Output formatters based on DataContractSerializer
options.AddXmlDataContractSerializerFormatter();

// To add XmlSerializer based Input and Output formatters.
options.InputFormatters.Add(new XmlSerializerInputFormatter());
options.OutputFormatters.Add(new XmlSerializerOutputFormatter());

});

services.AddMvc();

@pranavkm
Copy link
Contributor

The change was merged into beta5 release and not in to beta6 dev. I discovered this as part of beta6 branching in which time the diff in the classes made it difficult to merge. This work item needs to be redone.

See #2823

@pranavkm pranavkm reopened this Jul 17, 2015
@pranavkm pranavkm modified the milestones: 6.0.0-beta7, 6.0.0-beta5 Jul 17, 2015
@Eilon Eilon added 3 - Done and removed 1 - Ready labels Aug 12, 2015
@Eilon
Copy link
Member

Eilon commented Aug 12, 2015

This is already fixed.

@Eilon Eilon closed this as completed Aug 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants