Click or drag to resize

ControllerBase Class

Documentation can be found in: $/Omada Enterprise/Development/OmadaEnt/Docs/Design note - DB connection handling.docx
Inheritance Hierarchy
SystemObject
  Omada.OE.AppLogicControllerBase
    More...

Namespace:  Omada.OE.AppLogic
Assembly:  Omada.OE.AppLogic (in Omada.OE.AppLogic.dll) Version: 15.0.0.0
Syntax
C#
public abstract class ControllerBase : IController

The ControllerBase type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyConnectionString
Connection string for the database. Can be null.
Public propertyDbCommandTimeout
DbCommandTimeout is applied to SqlCommand objects created using CreateSqlCommand(). The DbCommandTimeout value is (normally) passed on to other controllers created by the controller. If DbCommandTimeout is Zero then the DB default will be used as timeout.
Public propertyDbConnection
Consider using CreateCommand() instead of accessing DbConnection directly. DbConnection and DbTransaction are either specified when constucting the controller or the controller constructs them itself (by using ConnectionString) when calling DoInConnection or DoInTransaction. If the caller specified DbConnection and DbTransaction when constucting the controller then the caller is responsible for the management of the connection.
Public propertyDbTransaction
Consider using CreateCommand() instead of accessing DbTransaction directly. DbConnection and DbTransaction are either specified when constucting the controller or the controller constructs them itself (by using ConnectionString) when calling DoInConnection or DoInTransaction. If the caller specified DbConnection and DbTransaction when constucting the controller then the caller is responsible for the management of the connection.
Public propertyFactory
Factory class for creating controller instances.
Top
Methods
  NameDescription
Protected methodBuildCacheKey
Builds a cache key for use with GetFromCacheIfPresent. The cache key is not hashed because we have experienced a collision using GetHashCode() ie. the cache keys are quite long and there is a price in dictionary size in memory and in dictionary lookups.
Protected methodCheckObjectOperationSecurity
Checks that the active user is allowed to perform an CRUD operation on a specific configuration object. (note: except that a Create operation is not for a specific object). Throws a SecurityException if not. Method can be used for all configuration objects that are represented by a ConfigurationObjectType (except those that have a compound key). Method checks auth role security as well as whether it is allowed to modify builtin/feature package objects.
Protected methodCheckObjectSaveOperationSecurity
Checks that the active user is allowed to Create a new - or Update an existing configuration object. Throws a SecurityException if not. Method can be used for all configuration objects that are represented by a ConfigurationObjectType (except those that have a compound key). Method checks auth role security as well as whether it is allowed to modify builtin/feature package objects.
Public methodConvertId(Int32, ConfigurationObjectType)
Converts the integer id of an object to its transport-safe unique id (UId).
Public methodConvertId(String, ConfigurationObjectType)
Converts a string representation of an integer or Guid id to an integer id.
Public methodConvertId(Guid, ConfigurationObjectType, Boolean)
Converts the transport-safe unique id (UId) of an object to its integer id.
Public methodConvertIds(IEnumerableGuid, ConfigurationObjectType)
Converts the transport-safe unique ids (UId) of a number of objects to integer ids.
Public methodConvertIds(IEnumerableInt32, ConfigurationObjectType)
Converts the integer ids of a number of objects to their transport-safe unique ids (UId).
Protected methodCreateCommand(SQLBuilder)
Protected methodCreateCommand(String)
Protected methodCreateSqlBulkCopy
Create a new SqlBulkCopy instance using the connection, transaction and timeout values from the controller
Public methodDoInConnection(ControllerBaseActionWithNoResult)
Executes an action that doesn't return a result. If no current connection exists, it will establish a connection to the database and close it afterwards. An existing connection will be reused. Inside the action, the connection is available as DbConnection.
Public methodDoInConnection(ActionSqlConnection, SqlTransaction, Boolean)
Executes an action that doesn't return a result. If no current connection exists, it will establish a connection to the database and close it afterwards. Connection and Transaction are passed to delegate, to allow passing to other controllers An existing connection will be reused. Inside the action, the connection is available as DbConnection. To ensure a new connection set forceNew to true.
Public methodDoInConnectionT(ControllerBaseActionWithResultT)
Executes an action and returns the result. If no current connection exists, it will establish a connection to the database and close it afterwards. An existing connection will be reused. Inside the action, the connection is available as DbConnection.
Public methodDoInTransaction(ControllerBaseActionWithNoResult)
Executes an action (that doesn't return a result) in a transaction. If no current connection and/or transaction exists, it will establish it and commit and close it afterwards. An existing connection/transaction will be reused. Inside the action, the connection is available as DbConnection and the transaction as DbTransaction.
Public methodDoInTransactionT(ControllerBaseActionWithResultT)
Executes an action in a transaction and returns the result. If no current connection and/or transaction exists, it will establish it and commit and close it afterwards. An existing connection/transaction will be reused. Inside the action, the connection is available as DbConnection and the transaction as DbTransaction.
Public methodDoInTransactionT(FuncSqlConnection, SqlTransaction, T, Boolean)
Executes an action in a transaction and returns the result. Connection and Transaction are passed to delegate, to allow passing to other controllers If no current connection and/or transaction exists, it will establish it and commit and close it afterwards. An existing connection/transaction will be reused. Set forceNew to true to ensure new connection and transaction Inside the action, the connection is available as DbConnection and the transaction as DbTransaction.
Protected methodDoInTransactionUnlessPostponedDueToPreviousDefaultResultT
The method can postpone a SQL transaction implemented by action if the method returns a default number, eg. 0. If the the action method throws a SQL transitent error, then the next call to action is also postponed.
Protected methodDoUnlessPostponedDueToPreviousDefaultResultT
The method can postpone a method invocation if the previous call returned a default number, eg. 0.
Protected methodExecScalarResultQueryT
Executes a query with a scalar result.
Public methodExecuteMutexOperation(String, Action, Boolean)
Protected methodExecuteMutexOperationT(String, FuncT, Boolean)
Protected methodExpireCacheItem
Protected methodStatic memberFireAndLogEventHandlers
Logs execution times for event handlers using System.Diagnostics
Protected methodGetDbUTCNow
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultIntegerList, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultAppIdentity, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultBoolean, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultIListGuid, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultListGuid, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultListInt32, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultGuid, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultInt32, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresent(String, ControllerBaseActionWithResultTimeZoneInfo, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresentT(String, ControllerBaseActionWithResultListT, ControllerBaseCacheOptions)
Public methodGetFromCacheIfPresentT(String, ControllerBaseActionWithResultT, ControllerBaseCacheOptions)
Retrieves some data from the cache or (if it is not there) executes an action and stores the result in the cache. Caching is not applied if the IgnoreCacheContext is used (depending on the parameter for it). Note: caching should only be used with great care as there are a number of potential issues involved in using it!
Protected methodGetNewRowIdentity
Protected methodGetObjectDataVersion
Gets the data version of an object.
Protected methodIncrementDataVersion
Protected methodIncrementObjectDataVersion(IEntityObject)
Increments the data version of an entity object. The data version is incremented in the db as well as on the object itself. Method is used to update the data version of an object when an aggregated object is created/modified/deleted. The purpose is to ensure that the id-based cache (in AppIdentity) is updated properly.
Protected methodIncrementObjectDataVersion(Int32, EntityObjectType)
Increments the data version of an entity object in the db. Method is used to update the data version of an object when an aggregated object is created/modified/deleted. The purpose is to ensure that the id-based cache (in AppIdentity) is updated properly.
Protected methodStatic memberLogEventExecutionTime
If customer setting TraceEventExecutionTime is set, an entry is written to tblEventLog with the execution time of an event handler. Can be used to trace long running event handlers.
Protected methodStatic memberLogEventOnEntry
If customer setting "TraceEventOnEntry" is set, an entry is written to tblEventLog. Can be used to trace chains of event. Endless chains of event can be detected by inspecting the recusion depth in the log.
Protected methodPopulateTempTableT
Creates a temporary db table with a single column and populates it with values.
Protected methodPostponeTransientErrorT
If the action throws a transient sql error, the exception is eaten. An entry is written to the log with level Information. The entire exception is written to the log with level Debug.
Protected methodTransferUIdsToIdsLoadOption
Converts/transfers one or more specified uids in a loadoptions object to ids. The purpose is to enable caching as IEntityObjectsLoadOptions.IdList only works with ids (and not uids).
Protected methodValidateDataVersionT
Validates that the data version of an object corresponds to the data version in the DB. Method is used for validation before saving an object.
Public methodStatic memberWaitForAsyncTaskT
Use this to invoke and await and async operation Function configures awaiter to avoid blocking operations
Top
Extension Methods
  NameDescription
Public Extension MethodToBool
Converts object to boolean.
(Defined by ObjectExtensions.)
Public Extension MethodToDateTime
Converts object to DateTime.
(Defined by ObjectExtensions.)
Public Extension MethodToInt
Converts object to integer.
(Defined by ObjectExtensions.)
Top
See Also
Inheritance Hierarchy
SystemObject
  Omada.OE.AppLogicControllerBase
    Omada.OE.AppLogicAccessModifierController
    Omada.OE.AppLogicAppStringController
    Omada.OE.AppLogicAssigneeExpressionController
    Omada.OE.AppLogicAuthRoleController
    Omada.OE.AppLogicAuthSourcePolicyController
    Omada.OE.AppLogicAzureAdController
    Omada.OE.AppLogicAzureLogAnalyticsController
    Omada.OE.AppLogicBrowserEventHandlerController
    Omada.OE.AppLogicCacheController
    Omada.OE.AppLogicCodeAssemblyController
    Omada.OE.AppLogicCodeMethodConfigController
    Omada.OE.AppLogicCodeMethodController
    Omada.OE.AppLogicConfigurationChangeController
    Omada.OE.AppLogicConfigurationChangeSetController
    Omada.OE.AppLogicConfigurationObjectController
    Omada.OE.AppLogicCopyDefinitionController
    Omada.OE.AppLogicCopyRuleController
    Omada.OE.AppLogicDashboardController
    Omada.OE.AppLogicDataConnectionController
    Omada.OE.AppLogicDataExchangeController
    Omada.OE.AppLogicDataObjectController
    Omada.OE.AppLogicDataObjectCounterController
    Omada.OE.AppLogicDataObjectDeletionController
    Omada.OE.AppLogicDataObjectFilterController
    Omada.OE.AppLogicDataObjectHistoryController
    Omada.OE.AppLogicDataObjectInViewMatrix
    Omada.OE.AppLogicDataObjectSearchDataController
    Omada.OE.AppLogicDataObjectTypeController
    Omada.OE.AppLogicDataSourceController
    Omada.OE.AppLogicEntityDataVersionController
    Omada.OE.AppLogicEventController
    Omada.OE.AppLogicEventLogEntryController
    Omada.OE.AppLogicFactory
    Omada.OE.AppLogicFeaturePackageController
    Omada.OE.AppLogicFileController
    Omada.OE.AppLogicFormController
    Omada.OE.AppLogic.HelpersAccessModifierHelper
    Omada.OE.AppLogic.HelpersAppStringHelper
    Omada.OE.AppLogic.HelpersProcessInstantiationHelper
    Omada.OE.AppLogic.HelpersSqlIdFilterHelperT
    Omada.OE.AppLogicIntegrityCheckController
    Omada.OE.AppLogicKPIController
    Omada.OE.AppLogicMailController
    Omada.OE.AppLogicMailTemplateController
    Omada.OE.AppLogicMasterController
    Omada.OE.AppLogicMenuController
    Omada.OE.AppLogic.MigrationVersion11MigrationController
    Omada.OE.AppLogicMIISController
    Omada.OE.AppLogic.ModelUpdateActionArgs
    Omada.OE.AppLogicModificationController
    Omada.OE.AppLogicObjectLogController
    Omada.OE.AppLogicProcessController
    Omada.OE.AppLogicProcessControllerAssigneeLogic
    Omada.OE.AppLogicProcessGraphController
    Omada.OE.AppLogicProcessPhaseController
    Omada.OE.AppLogicPropertyController
    Omada.OE.AppLogicReassignDefinitionController
    Omada.OE.AppLogicReferencePathController
    Omada.OE.AppLogicReportViewerController
    Omada.OE.AppLogicSecurityAlertEventController
    Omada.OE.AppLogicSequenceController
    Omada.OE.AppLogic.SerializationDeserializerBase
    Omada.OE.AppLogic.SerializationObjectImporter
    Omada.OE.AppLogic.SerializationObjectSerializer
    Omada.OE.AppLogic.SerializationPropertyValueAssigner
    Omada.OE.AppLogicServiceRuleController
    Omada.OE.AppLogicSettingController
    Omada.OE.AppLogicStatisticsController
    Omada.OE.AppLogicStylesheetController
    Omada.OE.AppLogicSubscriptionController
    Omada.OE.AppLogicSystemLogController
    Omada.OE.AppLogicTimerController
    Omada.OE.AppLogicTimerServiceController
    Omada.OE.AppLogicTimeZoneController
    Omada.OE.AppLogicUIActionController
    Omada.OE.AppLogicUserController
    Omada.OE.AppLogicUserGroupController
    Omada.OE.AppLogicVaultController
    Omada.OE.AppLogicViewController
    Omada.OE.AppLogicWebPageCacheController
    Omada.OE.AppLogicWebPageHelpContextController
    Omada.OE.AppLogicWorkWeekController
    Omada.OE.AppLogicXmlSchemaController
    Omada.OE.Solution.OIM.AppLogicAccessDataUploadController
    Omada.OE.Solution.OIM.AppLogicAccessRequestPopularityController
    Omada.OE.Solution.OIM.AppLogicAccountNotifcationEventHelper
    Omada.OE.Solution.OIM.AppLogic.AccountOwnershipAccountOwnershipController
    Omada.OE.Solution.OIM.AppLogicAppOnboardingController
    Omada.OE.Solution.OIM.AppLogic.ArchivingArchiveDBController
    Omada.OE.Solution.OIM.AppLogic.ArchivingArchivingController
    Omada.OE.Solution.OIM.AppLogicAttributeController
    Omada.OE.Solution.OIM.AppLogicAttributeValueHelper
    Omada.OE.Solution.OIM.AppLogic.AttributeValuesResourceAttributeValuesController
    Omada.OE.Solution.OIM.AppLogicAuditLogControllerBase
    Omada.OE.Solution.OIM.AppLogic.ClassificationClassificationController
    Omada.OE.Solution.OIM.AppLogicConstraintController
    Omada.OE.Solution.OIM.AppLogicContextController
    Omada.OE.Solution.OIM.AppLogicControlPolicyController
    Omada.OE.Solution.OIM.AppLogicEligibilityFilteringController
    Omada.OE.Solution.OIM.AppLogicEmergencyLockoutController
    Omada.OE.Solution.OIM.AppLogicIdentityController
    Omada.OE.Solution.OIM.AppLogicInitialPasswordController
    Omada.OE.Solution.OIM.AppLogicManualProvisioningController
    Omada.OE.Solution.OIM.AppLogicMiscController
    Omada.OE.Solution.OIM.AppLogicOmadaIdentitySystemController
    Omada.OE.Solution.OIM.AppLogic.OPSOPSControllerBase
    Omada.OE.Solution.OIM.AppLogicOrgUnitController
    Omada.OE.Solution.OIM.AppLogic.PackagedSolutionAccessRequestStatusController
    Omada.OE.Solution.OIM.AppLogicPasswordFilterController
    Omada.OE.Solution.OIM.AppLogicPasswordGenerationController
    Omada.OE.Solution.OIM.AppLogicPasswordResetController
    Omada.OE.Solution.OIM.AppLogic.PolicyCheckPolicyCheckController
    Omada.OE.Solution.OIM.AppLogicPrioritizationPolicyController
    Omada.OE.Solution.OIM.AppLogicQueueIdentityController
    Omada.OE.Solution.OIM.AppLogicResourceTypeController
    Omada.OE.Solution.OIM.AppLogicRoleApprovalController
    Omada.OE.Solution.OIM.AppLogicRoleAssignmentController
    Omada.OE.Solution.OIM.AppLogicRoleController
    Omada.OE.Solution.OIM.AppLogicRoleFolderController
    Omada.OE.Solution.OIM.AppLogic.RoPECalculatedAssignmentVerdictController
    Omada.OE.Solution.OIM.AppLogic.RoPEConnectionHelper
    Omada.OE.Solution.OIM.AppLogic.RoPEProvisioningClaimController
    Omada.OE.Solution.OIM.AppLogic.RoPEShadowObjectHelper
    Omada.OE.Solution.OIM.AppLogicRoPEController
    Omada.OE.Solution.OIM.AppLogicSelfManagementController
    Omada.OE.Solution.OIM.AppLogicSoDController
    Omada.OE.Solution.OIM.AppLogicSoDControllerV3
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyController
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyEventController
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyExportController
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyObjectCommandHelper
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyObjectGeneratorController
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyReportController
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyScheduleController
    Omada.OE.Solution.OIM.AppLogic.SurveyFeatureSurveyTemplateController
    Omada.OE.Solution.OIM.AppLogicSystemController
    Omada.OE.Solution.OIM.AppLogic.SystemOnboardingMigrationController
    Omada.OE.Solution.OIM.AppLogic.SystemOnboardingProvisioningConfigurationController
    Omada.OE.Solution.OIM.AppLogic.SystemOnboardingSOBControllerBase
    Omada.OE.Solution.OIM.AppLogic.SystemOnboardingWarehouseHelper
    Omada.OE.Solution.OIM.AppLogicTermsDocsController
    Omada.OE.Solution.OIM.AppLogicUserIDGeneratorController
    Omada.OE.Solution.OIM.AppLogicVaultMigrationController
    Omada.OE.Solution.OIM.Assembly.AppLogicCustomDataObjectController
    Omada.OE.Solution.OIM.Assembly.AppLogic.ShadowObjectsShadowDataObjectController
    Omada.OE.Solution.OIM.Assembly.AppLogic.ValueGeneration.LogicMailTemplatePlaceholderResolver
    Omada.OE.Solution.OIM.Assembly.AppLogic.ValueGeneration.LogicValueGenerationController
    Omada.OE.Solution.OIM.Assembly.PackagedSolutionSoDParameterBuilderController
    Omada.OE.Solution.OIM.Assembly.PackagedSolution.SoDV2SoDEvaluator
    Omada.OE.Solution.OIM.Assembly.PackagedSolution.SoDV3SoDEvaluatorV3
    Omada.OIS.AccessRequestSurveyApprovalSurveyApprovalController