-
Notifications
You must be signed in to change notification settings - Fork 218
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
V4 #169
V4 #169
Conversation
…bles, creates private methods for reuse and encapsulation, converts enumerable.Count() > 1 to enumerable.Any() etc.
…teMapResult and VideoSiteMapNode
…to it's own type; changes VideoSitemapNode to only extend by a collection of VideoNodeInformation to support 0..* videos per URL.
…sm to handle video, image, news, any site map.
…ames subfolder for video-node-related data etc.
…lder instead of Samples/, splits the test file into a .Tests project.
… several issues in the VideoSiteMapExtension uncovered by the validation. Modifies write order to correspond to the schema's sequence.
Conflicts: src/MvcSiteMapProvider/MvcSiteMapProvider.sln src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/XmlSiteMapResult.cs
Great. I took a look and there were a few things I noticed:
Here is a summary of the tools and conventions I used in the test project: Tools used:
Conventions used:
Here is the inheritance hierarchy for the node:
|
Hi! You are correct as to that the Ninject reference was an accident; I would be happy to contribute a Ninject module, though; I have to write some form of Ninject integration for my work project anyways I would assume. Is there a better place to ask about what kind of wiring up MvcSiteMapProvider needs, than issues / pull request comments? I had a look at the DI setup in the projects but am not 100% familiar with what is already used. As for all other points mentioned, I will see to implementing them as soon as I can. (And thank you for writing such helpful, approachable responses; I have met a lot of developers who would "bash noobs", rather than provide constructive feedback like this. It's refreshing (unfortunately). :)) |
Well, first drafts are almost always sloppy :). Besides, I have only been involved with this project since January, so I am a bit of a noob myself. Most of what I did was refactoring the code that was there previously, but I did all of that just so I could build in the multi-tenant support that I needed. I will let you know on the Ninject module - I am working with Maarten to try to straighten out the DI configuration code and corresponding Nuget packages. Just so you know what you are in for, have a look at the MvcSiteMapProviderRegistry.cs and MvcRegistry.cs files. These are to configure StructureMap. The former is everything that is needed for a "standard" configuration of MvcSiteMapProvider, the latter is to prevent MVC from throwing an error because instances of controllers are not allowed to be reused. Do note that this code will be injected into the MVC project as code files so they can be altered by the end developer as needed. |
Update: I have added additional projects to the solution to make building DI wiring code easier to contribute and maintain. https://github.com/maartenba/MvcSiteMapProvider/tree/v4/src/MvcSiteMapProvider/CodeAsConfiguration I have also added a skeleton project for Ninject - all that is left is to implement the "default" wiring code for Ninject the same way it is for StructureMap: A few things to be aware of in the projects in the CodeAsConfiguration folder:
|
Hi! An update for me as well - unfortunately, as so often, priorities have changed on the project I work on. I have to postpone working on this for a while. Potentially a few weeks. I am sorry for this back-and-forth. |
Not a problem. This is the nature of open source :). FYI - I just finished (I hope) the pre-release Nuget packages today. You can view them on this feed: https://www.myget.org/F/mvcsitemapprovider/. The ones that don't match version numbers with the highest version are no longer valid - we ended up changing the package structure a few times because Nuget doesn't support multiple versions of MVC. |
UpdateI have created a functional Ninject module for MvcSiteMapProvider. However, it needs to be a little safer to interact with a real-world configuration. Namely, it should only auto-register types for interfaces that are part of MvcSiteMapProvider or MVC/.NET interfaces that are defined by MvcSiteMapProvider. This could be accomplished by not registering any interfaces that are already registered with Ninject. There is probably a really simple way to accomplish that, but I am a bit clueless when it comes to Ninject. Could you please have a look and see if you can work out how to make this code a little safer? Do note that I realize the named instances are not required for this particular configuration, but I put them in so another developer can easily find the path to providing additional implementations of the same interfaces that are explicitly injected into the right place by providing additional named instances. The support I put in was specifically for multi-tenant applications, but our stock configuration is just single-tenant. You can run MvcMusicStore in debug mode with the "Ninject" compilation symbol in order to try out any changes you may do. Also note the Ninject Nuget packages at https://www.myget.org/F/mvcsitemapprovider/ now contain functional code as well in case you want to see how it the code ends up in the final application. Just be sure to set the pre-release switch and to grab the highest versioned package. Don't worry about DependencyResolver - I am seriously considering dropping support for it because it requires a bunch of extra garbage above and beyond what DI really needs. If someone really wants to fuss with it they are welcome to grab the Nuget packages that contain modules only. |
Never mind. I decided to go a different route. I created a couple of container agnostic conventions that I can use to ensure I don't inadvertently register stuff that isn't required. Not only does this make sure we will play nice with other DI modules, it also means we don't have to learn the drastically different APIs for each DI container's auto-registration methodology or their special quirks. Ninject even puts their conventions in a separate Nuget package which we now also don't need to include as a dependency. The simplest solutions turn out to be the best ones. So, in short I won't need your help to put this together because I am sure it is working. I am leaving your original issue #138 open, but being that this pull request is now out of date I am marking it closed. Feel free to submit another pull request when you get the chance to complete your implementation. |
…ing, string> to allow arbitrary objects to be attached to a node. See #169.
As discussed in #138, I extended XmlSiteMapResult and XmlSiteMapNode to inject arbitrary additional content into sitemap nodes (for video, picture, news sitemaps) without having to subclass for each type.