Hi,
I implemented the following classes:
public class Documento : Entity
{
public string Serie { get; private set; }
public DocumentoDados Dados { get; private set; }
}
public class DocumentoDados : ValueObject
{
public int DocumentoId { get; set; }
public Morada ClienteMorada { get; set; }
public string EmissorDesignacao { get; set; }
public Morada EmissorMorada { get; set; }
}
public class Morada : ValueObject
{
public string Rua { get; set; }
public string Numero { get; set; }
public string CodigoPostal { get; set; }
public string Localidade { get; set; }
}
Using the proposal @AndriySvyryd made on issue #15681 proposal I'm able to configure my OwnedEntities, but I can't seem to Create a Configuration for the nested Owned Type "Morada" within "DocumentoDados" on the "Documento" Entity.
Has anyone come across this before?
Hello,
You can add the following extension method
public static OwnedNavigationBuilder<TEntity, TNewDependentEntity> ApplyOwnsOneConfiguration<TEntity, TNewDependentEntity, TOwnedEntity>(
this OwnedNavigationBuilder<TEntity, TNewDependentEntity> entityTypeBuilder,
Expression<Func<TNewDependentEntity, TOwnedEntity>> navigationExpression,
IOwnedNavigationConfiguration<TNewDependentEntity, TOwnedEntity> configuration)
where TEntity : class
where TNewDependentEntity : class
where TOwnedEntity : class
{
entityTypeBuilder.OwnsOne(navigationExpression, configuration.Configure);
return entityTypeBuilder;
}
Hello,
You can add the following extension method
public static OwnedNavigationBuilder<TEntity, TNewDependentEntity> ApplyOwnsOneConfiguration<TEntity, TNewDependentEntity, TOwnedEntity>( this OwnedNavigationBuilder<TEntity, TNewDependentEntity> entityTypeBuilder, Expression<Func<TNewDependentEntity, TOwnedEntity>> navigationExpression, IOwnedNavigationConfiguration<TNewDependentEntity, TOwnedEntity> configuration) where TEntity : class where TNewDependentEntity : class where TOwnedEntity : class { entityTypeBuilder.OwnsOne(navigationExpression, configuration.Configure); return entityTypeBuilder; }
Thanks, worked like a charm!
Most helpful comment
Hello,
You can add the following extension method