protected override IEnumerable <MigrationOperation> Add(IProperty target, DiffContext diffContext, bool inline = false) { var schema = _cassandraOptionsExtension.DefaultKeyspace; var targetEntityType = target.DeclaringEntityType.GetRootType(); var et = targetEntityType.Model.FindEntityType(target.ClrType); Type clrType; IEntityType userDefinedType = null; if (et == null || !et.IsUserDefinedType()) { var typeMapping = TypeMappingSource.GetMapping(target); clrType = typeMapping.Converter?.ProviderClrType ?? (typeMapping.ClrType).UnwrapNullableType(); } else { clrType = target.ClrType; userDefinedType = et; } var operation = new AddColumnOperation { Schema = schema, Table = targetEntityType.GetTableName(), Name = target.GetColumnName() }; Initialize( operation, target, clrType, target.IsColumnNullable(), MigrationsAnnotations.For(target), inline, userDefinedType); yield return(operation); }
private ValueConverter GetValueConverter(IProperty property) => TypeMappingSource.GetMapping(property).Converter;