Exemplo n.º 1
0
        /// <inheritdoc/>
        public IEnumerable <AnyTableSqlParameter> GetAllParametersForParentTable(IMapsDirectlyToDatabaseTable parent)
        {
            var type = parent.GetType();

            if (!AnyTableSqlParameter.IsSupportedType(type))
            {
                throw new NotSupportedException("This table does not support parents of type " + type.Name);
            }

            return(GetReferencesTo <AnyTableSqlParameter>(parent));
        }
        /// <inheritdoc/>
        /// <remarks>Consults each <see cref="OtherDependencyFinders"/> for CASCADE logic then deletes any <see cref="AnyTableSqlParameter"/> declared
        /// on the deleted object</remarks>
        /// <param name="oTableWrapperObject"></param>
        public void HandleCascadeDeletesForDeletedObject(IMapsDirectlyToDatabaseTable oTableWrapperObject)
        {
            foreach (IObscureDependencyFinder obscureDependencyFinder in OtherDependencyFinders)
            {
                obscureDependencyFinder.HandleCascadeDeletesForDeletedObject(oTableWrapperObject);
            }

            //Delete any SQLFilterParameters associated with the parent object (which has just been deleted!)
            if (AnyTableSqlParameter.IsSupportedType(oTableWrapperObject.GetType()))
            {
                foreach (var p in _repository.GetAllParametersForParentTable(oTableWrapperObject))
                {
                    p.DeleteInDatabase();
                }
            }
        }
Exemplo n.º 3
0
        public ParameterCollectionUIOptions(string useCase, ICollectSqlParameters collector, ParameterLevel currentLevel, ParameterManager parameterManager, CreateNewSqlParameterHandler createNewParameterDelegate = null)
        {
            UseCase                     = useCase;
            Collector                   = collector;
            CurrentLevel                = currentLevel;
            ParameterManager            = parameterManager;
            _createNewParameterDelegate = createNewParameterDelegate;

            if (_createNewParameterDelegate == null)
            {
                if (AnyTableSqlParameter.IsSupportedType(collector.GetType()))
                {
                    _createNewParameterDelegate = CreateNewParameterDefaultImplementation;
                }
            }
        }