Beispiel #1
0
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public override void ValidateTypeName(string storeType)
 {
     if (_disallowedMappings.Contains(storeType))
     {
         throw new ArgumentException(JetStrings.UnqualifiedDataType(storeType));
     }
 }
Beispiel #2
0
        public void IsDate_should_throw_on_client_eval()
        {
            var exIsDate = Assert.Throws <InvalidOperationException>(() => EF.Functions.IsDate("#ISDATE#"));

            Assert.Equal(
                JetStrings.FunctionOnClient(nameof(JetDbFunctionsExtensions.IsDate)),
                exIsDate.Message);
        }
Beispiel #3
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        protected override void ValidateMapping(CoreTypeMapping mapping, IProperty property)
        {
            var relationalMapping = mapping as RelationalTypeMapping;

            if (_disallowedMappings.Contains(relationalMapping?.StoreType))
            {
                if (property == null)
                {
                    throw new ArgumentException(JetStrings.UnqualifiedDataType(relationalMapping.StoreType));
                }

                throw new ArgumentException(JetStrings.UnqualifiedDataTypeOnProperty(relationalMapping.StoreType, property.Name));
            }
        }
        private static void CheckValueGenerationStrategy(IProperty property, JetValueGenerationStrategy?value)
        {
            if (value != null)
            {
                var propertyType = property.ClrType;

                if (value == JetValueGenerationStrategy.IdentityColumn &&
                    !IsCompatibleWithValueGeneration(property))
                {
                    throw new ArgumentException(
                              JetStrings.IdentityBadType(
                                  property.Name, property.DeclaringEntityType.DisplayName(), propertyType.ShortDisplayName()));
                }
            }
        }
 /// <summary>
 ///     Validate if the given string is a valid date.
 ///     Corresponds to the SQL Server's ISDATE('date').
 /// </summary>
 /// <param name="_">The DbFunctions instance.</param>
 /// <param name="expression">Expression to validate</param>
 /// <returns>true for valid date and false otherwise.</returns>
 public static bool IsDate(
     [CanBeNull] this DbFunctions _,
     [NotNull] string expression)
 => throw new InvalidOperationException(JetStrings.FunctionOnClient(nameof(IsDate)));