-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created SiteMapBuilderFactory to assist with DI containers that do no…
…t have a way to resolve single parameters of constructors.
- Loading branch information
1 parent
08efd18
commit 74313f4
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/MvcSiteMapProvider/MvcSiteMapProvider/Builder/SiteMapBuilderFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using MvcSiteMapProvider.Caching; | ||
using MvcSiteMapProvider.Visitor; | ||
|
||
namespace MvcSiteMapProvider.Builder | ||
{ | ||
public class SiteMapBuilderFactory | ||
{ | ||
public SiteMapBuilderFactory( | ||
ISiteMapNodeVisitor siteMapNodeVisitor, | ||
ISiteMapHierarchyBuilder siteMapHierarchyBuilder, | ||
ISiteMapCacheKeyGenerator siteMapCacheKeyGenerator, | ||
ISiteMapNodeHelperFactory siteMapNodeHelperFactory | ||
) | ||
{ | ||
if (siteMapNodeVisitor == null) | ||
throw new ArgumentNullException("siteMapNodeVisitor"); | ||
if (siteMapHierarchyBuilder == null) | ||
throw new ArgumentNullException("siteMapHierarchyBuilder"); | ||
if (siteMapCacheKeyGenerator == null) | ||
throw new ArgumentNullException("siteMapCacheKeyGenerator"); | ||
if (siteMapNodeHelperFactory == null) | ||
throw new ArgumentNullException("siteMapNodeHelperFactory"); | ||
|
||
this.siteMapHierarchyBuilder = siteMapHierarchyBuilder; | ||
this.siteMapCacheKeyGenerator = siteMapCacheKeyGenerator; | ||
this.siteMapNodeHelperFactory = siteMapNodeHelperFactory; | ||
this.siteMapNodeVisitor = siteMapNodeVisitor; | ||
} | ||
protected readonly ISiteMapHierarchyBuilder siteMapHierarchyBuilder; | ||
protected readonly ISiteMapCacheKeyGenerator siteMapCacheKeyGenerator; | ||
protected readonly ISiteMapNodeHelperFactory siteMapNodeHelperFactory; | ||
protected readonly ISiteMapNodeVisitor siteMapNodeVisitor; | ||
|
||
public virtual ISiteMapBuilder Create(ISiteMapNodeProvider siteMapNodeProvider) | ||
{ | ||
return new SiteMapBuilder( | ||
siteMapNodeProvider, | ||
this.siteMapNodeVisitor, | ||
this.siteMapHierarchyBuilder, | ||
this.siteMapCacheKeyGenerator, | ||
this.siteMapNodeHelperFactory); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters