Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyDirection"></param>
        /// <returns></returns>
        public string GetName(DbQueryPropertyDirections propertyDirection)
        {
            var _enableToMergePrefix = false;

            if (propertyDirection.Equals(DbQueryPropertyDirections.Input))
            {
                if (string.IsNullOrEmpty(_cachedInputName))
                {
                    _enableToMergePrefix = ActionDescriptors.IsDeclared(x =>
                                                                        x.PropertyDirection.HasFlag(DbQueryPropertyDirections.Input) && x.EnableToMergePrefixForInput);

                    return(_cachedInputName = GetName(_enableToMergePrefix));
                }

                return(_cachedInputName);
            }
            else if (propertyDirection.Equals(DbQueryPropertyDirections.Output))
            {
                if (string.IsNullOrEmpty(_cachedOutputName))
                {
                    _enableToMergePrefix = ActionDescriptors.IsDeclared(x =>
                                                                        x.PropertyDirection.HasFlag(DbQueryPropertyDirections.Output) && x.EnableToMergePrefixForOutput);

                    return(_cachedOutputName = GetName(_enableToMergePrefix));
                }

                return(_cachedOutputName);
            }

            return(null);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyDirection"></param>
        /// <returns></returns>
        public static ParameterDirection PropertyDirectionToParameterDirection(DbQueryPropertyDirections propertyDirection)
        {
            switch (propertyDirection)
            {
            case DbQueryPropertyDirections.Input:
                return(ParameterDirection.Input);

            case DbQueryPropertyDirections.Output:
                return(ParameterDirection.Output);

            case DbQueryPropertyDirections.InputOutput:
                return(ParameterDirection.InputOutput);
            }

            return(ParameterDirection.Input);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyDescriptor"></param>
        /// <param name="parameterName"></param>
        /// <param name="propertyDirection"></param>
        /// <returns></returns>
        protected virtual SqlParameter CreateParameter(DbQueryPropertyDescriptor propertyDescriptor, string parameterName, DbQueryPropertyDirections propertyDirection)
        {
            var _parameter = new SqlParameter();

            _parameter.ParameterName = AdoDotNetDbParameterHelpers.StringToParameterName(parameterName);
            _parameter.Direction     = AdoDotNetDbParameterHelpers.PropertyDirectionToParameterDirection(propertyDirection);
            _parameter.SqlDbType     = propertyDescriptor.DbType;
            _parameter.Size          = propertyDescriptor.Size;

            if (propertyDescriptor.DbType.Equals(SqlDbType.Decimal))
            {
                if (!ObjectUtils.IsNullOrDefault(propertyDescriptor.Scale))
                {
                    _parameter.Scale = propertyDescriptor.Scale;
                }

                if (!ObjectUtils.IsNullOrDefault(propertyDescriptor.Precision))
                {
                    _parameter.Precision = propertyDescriptor.Precision;
                }
            }

            return(_parameter);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="propertyDirection"></param>
 /// <returns></returns>
 public DbQueryActionDescriptors GetDescriptorsByPropertyDirection(DbQueryPropertyDirections propertyDirection)
 {
     return(GetDescriptorsByQueryAction(x => x.PropertyDirection.HasFlag(propertyDirection)));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="propertyDirection"></param>
 /// <returns></returns>
 public bool IsDeclared(DbQueryPropertyDirections propertyDirection)
 {
     return(IsDeclared(x => x.PropertyDirection.HasFlag(propertyDirection)));
 }