Exemplo n.º 1
0
        public ColumnDefinition DeepCloneWithSqlDataType(SqlDataTypeRepresentationBase sqlDataType)
        {
            var result = new ColumnDefinition(
                this.Name?.DeepClone(),
                sqlDataType);

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OutputParameterDefinition{TValue}"/> class.
        /// </summary>
        /// <param name="name">The name of the parameter.</param>
        /// <param name="sqlDataType">The SQL data type of the parameter.</param>
        public OutputParameterDefinition(
            string name,
            SqlDataTypeRepresentationBase sqlDataType)
            : base(name, sqlDataType)
        {
            sqlDataType.MustForArg(nameof(sqlDataType)).NotBeNull();

            ThrowArgumentExceptionIfSqlDataTypeIsNotCompatibleWithDotNetDataType(sqlDataType, typeof(TValue));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ColumnDefinition"/> class.
        /// </summary>
        /// <param name="name">The name of the column.</param>
        /// <param name="sqlDataType">The SQL data type of the column.</param>
        public ColumnDefinition(
            string name,
            SqlDataTypeRepresentationBase sqlDataType)
        {
            name.MustForArg(nameof(name)).NotBeNullNorWhiteSpace().And().BeAlphanumeric(ColumnNameAlphanumericOtherAllowedCharacters);
            sqlDataType.MustForArg(nameof(sqlDataType)).NotBeNull();

            this.Name        = name;
            this.SqlDataType = sqlDataType;
        }
 /// <summary>
 /// Throws an <see cref="ArgumentException"/> if the specified SQL data type is not compatible with the specified .NET data type.
 /// </summary>
 /// <param name="sqlDataType">The SQL data type.</param>
 /// <param name="dotNetDataType">The .NET data type.</param>
 protected static void ThrowArgumentExceptionIfSqlDataTypeIsNotCompatibleWithDotNetDataType(
     SqlDataTypeRepresentationBase sqlDataType,
     Type dotNetDataType)
 {
     try
     {
         sqlDataType.ValidateObjectTypeIsCompatible(dotNetDataType);
     }
     catch (InvalidOperationException ex)
     {
         throw new ArgumentException(Invariant($"The specified {nameof(sqlDataType)} is not compatible with the specified {nameof(dotNetDataType)}.  See inner exception."), ex);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InputParameterDefinitionBase"/> class.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="sqlDataType">The SQL data type of the parameter.</param>
 protected InputParameterDefinitionBase(
     string name,
     SqlDataTypeRepresentationBase sqlDataType)
     : base(name, sqlDataType)
 {
 }
 public virtual ParameterDefinitionBase DeepCloneWithSqlDataType(SqlDataTypeRepresentationBase sqlDataType)
 {
     throw new NotImplementedException("This method should be abstract.  It was generated as virtual so that you aren't forced to override it when you create a new model that derives from this model.  It will be overridden in the generated designer file.");
 }