Exemplo n.º 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>
        protected override void ValidateMapping(CoreTypeMapping mapping, IProperty property)
        {
            var relationalMapping = mapping as RelationalTypeMapping;

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

                throw new ArgumentException(MySqlStrings.UnqualifiedDataTypeOnProperty(relationalMapping.StoreType, property.Name));
            }
        }
Exemplo n.º 2
0
        public void Throws_for_naked_type_name_on_property(string typeName)
        {
            var builder = CreateModelBuilder();

            var property = builder.Entity <StringCheese>()
                           .Property(e => e.StringWithSize)
                           .HasColumnType(typeName)
                           .Metadata;

            var mapper = CreateTypeMapper();

            Assert.Equal(
                MySqlStrings.UnqualifiedDataTypeOnProperty(typeName, nameof(StringCheese.StringWithSize)),
                Assert.Throws <ArgumentException>(() => mapper.FindMapping(property)).Message);
        }