Skip to content

Hard dependency to MVC setup #71

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

Closed
JanMattner opened this issue Mar 23, 2017 · 4 comments
Closed

Hard dependency to MVC setup #71

JanMattner opened this issue Mar 23, 2017 · 4 comments

Comments

@JanMattner
Copy link
Contributor

JanMattner commented Mar 23, 2017

Currently, MVC is setup inside the JSONAPI Framework's own calls and there is no possibility to customize the MVC setup e.g. with custom options. There should be a possibility to customize the calls or do them on one's own.

Particularly: IApplicationBuilderExtension and IServiceCollectionExtensions

... working on it...

@JanMattner
Copy link
Contributor Author

Okay I just realized that the dependency in IServiceCollectionExtensions is actually not that hard since you can basically do everything on your own what's done in _addInternals:

            services.AddJsonApiInternals<TContext>(jsonApiOptions);
            services.AddMvc()
                .AddMvcOptions(opt => {
                    opt.Filters.Add(typeof(JsonApiExceptionFilter));
                    opt.SerializeAsJsonApi(jsonApiOptions);
                });

AddJsonApiInternals, SerializeAsJsonApi and JsonApiExceptionFilter are all public, thus we can just replicate that code if necessary. However, it would be more convenient to have a method that just takes an IMvcBuilder as input.

What do you think?

@jaredcnance
Copy link
Contributor

jaredcnance commented Mar 23, 2017

AddJsonApiInternals, SerializeAsJsonApi and JsonApiExceptionFilter are all public, thus we can just replicate that code

I think that was my original intent for extensibility

However, it would be more convenient to have a method that just takes an IMvcBuilder as input.

I think this is a good solution

jaredcnance added a commit that referenced this issue Mar 23, 2017
Fix #71 Hard dependency to MVC setup
@jaredcnance
Copy link
Contributor

@JanMattner did you want to add an overload for the services? or I can do it tonight. i'd like to get both of these in before pushing develop into master

@JanMattner
Copy link
Contributor Author

@jaredcnance No sorry, probably can't do it this weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants