Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolução do mapeamento de construtores. #6

Open
Tracked by #1
eglauko opened this issue May 30, 2022 · 3 comments
Open
Tracked by #1

Resolução do mapeamento de construtores. #6

eglauko opened this issue May 30, 2022 · 3 comments
Assignees
Labels
blocked Issue blocked for some reason In progress Work in progress Task A task to work
Milestone

Comments

@eglauko
Copy link
Member

eglauko commented May 30, 2022

Samples:

// configure the constructor

// the target constructor must have two paramters
builder.Constructor().WithParameters(2);

// the target constructor must have a single parameter of type string
builder.Constructor().WithParameters(typeof(string));

// configure the target constructor parameters with the source properties
builder.Constructor().Parameters(x => x.Name, x => x.Age);

// configure the inner properties of a source property to be mapped to the constructor
builder.Map(x => x.SomeProp).ToConstructor();
// or
builder.Constructor().MapInnerProperties(x => x.SomeProp);

// configure a source property to be mapped to a parameter of the target constructor
builder.Map(x => x.Name).ToConstructor().ToParameter();
// or
builder.Constructor().Map(x => x.Name);
@eglauko eglauko mentioned this issue May 30, 2022
6 tasks
@eglauko eglauko self-assigned this May 30, 2022
@eglauko eglauko added this to the preview 1 milestone May 30, 2022
@eglauko eglauko added New New item to work Task A task to work labels May 30, 2022
@eglauko eglauko added In progress Work in progress and removed New New item to work labels Sep 6, 2022
@eglauko
Copy link
Member Author

eglauko commented Sep 6, 2022

O que se espera da descoberta de construtores:

  • Olhando para o ConstructorOptions, obtém os construtores possíveis.
  • Verifica as propriedades mapeadas para os construtores.
    • Verifica quais parâmetros elas atendem
    • Se não atender nenhum parâmetro registra um erro
    • Se alguma propriedade atende um parâmetro de um construtor e outra de outro construtor, registra um erro.
  • Se há construtores incompletos, tenta descobrir os outros parâmetros para eles.
  • Se há construtores completos, valida os tipos de dados. Registra erros, mas só os usa se nenhum construtor for satisfeito
  • Se há um ou mais construtores satisfeitos, obtém o melhor.
  • Se não houver nenhum construtor habilitado, registra um erro.

@eglauko
Copy link
Member Author

eglauko commented Sep 17, 2022

O Fluxo descrito mudou.
Será olhado para cada parâmetro do construtor e tentado associar alguma propriedade.

@eglauko
Copy link
Member Author

eglauko commented Sep 17, 2022

Esta tarefa ficará bloqueada até fechamento do #9

@eglauko eglauko added the blocked Issue blocked for some reason label Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Issue blocked for some reason In progress Work in progress Task A task to work
Projects
None yet
Development

No branches or pull requests

1 participant