• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class ServiceLocator<TContract, TSelf>

Provides a readily testable way to manage a Singleton.

Inheritance
System.Object
ServiceLocator<TContract, TSelf>
EntitiesController
SettingsController
EventsController
LocalizationController
ModulesController
PersonaBarController
PersonaBarUserSettingsController
PersonaBarExtensionRepository
PersonaBarRepository
TestableGlobals
CBO
JavaScriptUtils
ControllerBase<TEntity, TContract, TSelf>
ContentController
WorkflowActionManager
SystemWorkflowManager
WorkflowEngine
WorkflowLogger
WorkflowManager
WorkflowSecurity
WorkflowStateManager
EventManager
TestableModuleController
ModuleController
PortalTemplateIO
TestablePortalAliasController
TestablePortalController
PortalAliasController
PortalController
PortalTemplateController
TestableTabController
TabChangeSettings
TabChangeTracker
TabController
TabModulesController
TabPublishingController
TabVersionBuilder
TabVersionController
TabVersionDetailController
TabVersionSettings
TabWorkflowSettings
TestableUserController
FollowersController
FriendsController
RelationshipController
UserController
JavaScriptLibraryController
ServicesFramework
CommandRepository
AuthCookieController
FolderPermissionController
TestableRoleController
RoleController
ConnectionsController
ConnectionsManager
FileLinkClickController
FolderMappingsConfigController
FileDeletionController
FileLockingController
FileSecurityController
UserSecurityController
InstallBlocker
PackageController
InternalJournalController
JournalController
JournalDataService
TestableLocalization
EventLogController
LogController
RegistrationProfileController
SearchController
InternalSearchController
SearchHelper
SearchQueryStringParser
InternalMessagingController
MessagingController
UserPreferencesController
NotificationsController
DataService
SubscriptionController
SubscriptionSecurityController
SubscriptionTypeController
InstallController
UserRequestIPAddressController
Namespace: DotNetNuke.Framework
Assembly: DotNetNuke.dll
Syntax
public abstract class ServiceLocator<TContract, TSelf> : object where TSelf : ServiceLocator<TContract, TSelf>, new()
Type Parameters
Name Description
TContract

The interface that the controller provides.

TSelf

The type of the controller itself, used to call the GetFactory override.

Properties

| Improve this Doc View Source

Factory

Gets or sets the service locator factory.

Declaration
protected static Func<TContract> Factory { get; set; }
Property Value
Type Description
Func<TContract>
| Improve this Doc View Source

Instance

Gets a singleton of T.

Declaration
public static TContract Instance { get; }
Property Value
Type Description
TContract

Methods

| Improve this Doc View Source

ClearInstance()

Clears the current instance, a new instance will be initialized when next requested.

Declaration
public static void ClearInstance()
Remarks

Intended for unit testing purposes, not thread safe.

| Improve this Doc View Source

GetFactory()

Gets the service locator factory.

Declaration
protected abstract Func<TContract> GetFactory()
Returns
Type Description
Func<TContract>

A factory function.

| Improve this Doc View Source

SetTestableInstance(TContract)

Registers an instance to use for the Singleton.

Declaration
public static void SetTestableInstance(TContract instance)
Parameters
Type Name Description
TContract instance

The instance to set.

Remarks

Intended for unit testing purposes, not thread safe.

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS