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

Support mixed formulas and columns in By Code #1759

Merged

Conversation

fredericDelaporte
Copy link
Member

@fredericDelaporte fredericDelaporte commented Jun 19, 2018

Many mapping elements allow to define their columns or formulas by nested elements, but most of them were not supporting having both nested columns and formulas.

Follow up to #1808, which has added this support for hbm mappings.

Fixes #1278 by the way.

fredericDelaporte added a commit to fredericDelaporte/nhibernate-core that referenced this pull request Jun 19, 2018
Fix a null reference exception in OneToManyPersister

Spotted while testing nhibernate#1759
@fredericDelaporte

This comment has been minimized.

@hazzik

This comment has been minimized.

@fredericDelaporte

This comment has been minimized.

@fredericDelaporte

This comment has been minimized.

@fredericDelaporte

This comment has been minimized.

fredericDelaporte added a commit that referenced this pull request Jun 25, 2018
Fix a null reference exception in OneToManyPersister

Spotted while testing #1759
@hazzik
Copy link
Member

hazzik commented Jun 26, 2018

Can we come up with a better name other that "ColumnsAndFormulas"? Or some other method how to declare these?

@fredericDelaporte
Copy link
Member Author

The way mapping by code is designed, I have no better idea.
Current existing methods are void Columns for mapping many columns, void Column for mapping a single column and void Formula for mapping a single formula. None of them allows for chaining.

So for mapping many columns and formulas, a void ColumnsAndFormulas method seems quite consistent with the current API shape.

Introducing something like MapMultiple().Column(...).Formula(...).Column(...) would be very inconsistent with the current API shape.

@fredericDelaporte
Copy link
Member Author

Since the mapping by code naming seems to block this issue, I think the hbm mapping fix should be merged separately. I will add a separated PR.

@fredericDelaporte fredericDelaporte changed the title Support mixed formulas and columns WIP - Support mixed formulas and columns Oct 30, 2018
@fredericDelaporte

This comment has been minimized.

/// </summary>
/// <param name="columnOrFormulaMapper">The mappers for each column or formula.</param>
/// <remarks>Replaces any previously mapped column or formula.</remarks>
void ColumnsAndFormulas(params Action<IColumnOrFormulaMapper>[] columnOrFormulaMapper);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still do not have a better name. In fact, I do not think there is a better name fitting the current API shape, which already does not follow usual guidelines for method names. (For example, they are not prefixed by an imperative verb.)

@fredericDelaporte fredericDelaporte changed the title WIP - Support mixed formulas and columns Support mixed formulas and columns Nov 6, 2018
@fredericDelaporte fredericDelaporte changed the title Support mixed formulas and columns Support mixed formulas and columns in By Code Nov 7, 2018
@fredericDelaporte fredericDelaporte merged commit 61d9fda into nhibernate:master Nov 8, 2018
@fredericDelaporte fredericDelaporte deleted the ColumnAndFormula branch November 8, 2018 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants