public override void Process(EfProcessorContext ctx, EfPropertyDefinition definition) { if (_providers.All(e => e != ctx.DatabaseContext.Provider)) { ctx.Entity.Ignore(definition.Property.Name); // TODO is this correct or do we use the column name here } }
public override void Process(EfProcessorContext ctx, EfPropertyDefinition definition) { var k = ctx.Entity.HasAlternateKey(definition.Property.Name); if (_name != null) { k.HasName(_name); // TODO i dont think this matters } }
public override void Process(EfProcessorContext ctx, IReadOnlyCollection <EfPropertyDefinition> properties) { var indexParams = properties .Select(def => (prop: def.Property, attr: def.Source as IndexAttribute)) .GroupBy(item => item.attr.Name) .Select(group => { var first = group.First(); if (group.Key == null) { return(new IndexParam(first.attr, first.prop)); } return(new IndexParam( first.attr, group.OrderBy(item => item.attr.Order).Select(item => item.prop).ToArray())); }); string prefix = null; foreach (var indexParam in indexParams) { var indexBuilder = ctx.Entity .HasIndex(indexParam.PropertyNames) .IsUnique(indexParam.IsUnique); if (indexParam.IndexName != null) { if (indexParam.IsLocal && prefix == null) { prefix = ctx.ClrType.GetCustomAttribute <TableAttribute>()?.Name ?? throw new EfAttributeException(""); indexBuilder.HasName($"{prefix}_{indexParam.IndexName}"); } else { indexBuilder.HasName(indexParam.IndexName); } } } }
public override void Process(EfProcessorContext ctx, EfPropertyDefinition definition) { ctx.Entity.Property(definition.Property.Name) .HasAnnotation(_annotation, _value); }
public override bool PropertyMatches(EfProcessorContext ctx, EfPropertyDefinition definition) => true;