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

Incorrect mapping when having an identity property with a different name than "Id", and the "Id" property which is not an identity column. #431

Closed
xhafan opened this issue Mar 15, 2019 · 0 comments · Fixed by #671
Labels
Milestone

Comments

@xhafan
Copy link

xhafan commented Mar 15, 2019

When mapping this class:

    public class DestinationListItemDto
    {
        public int DestinationId { get; set; }
        public Guid Id { get; set; }
    }

    public class DestinationListItemDtoMappingOverrides : IAutoMappingOverride<DestinationListItemDto>
    {
        public void Override(AutoMapping<DestinationListItemDto> mapping)
        {
            mapping.Id(x => x.DestinationId);
        }
    }

the generated schema looks like this:

    create table "DestinationListItemDto" (
        "Id" uuid not null,
       primary key ("Id")
    );

Which is incorrect - the DestinationId columns is missing. When I add this line into the mapping:

        mapping.Map(x => x.Id);

the generated schema looks better:

    create table "DestinationListItemDto" (
        "DestinationId"  serial,
       "Id" uuid not null,
       primary key ("DestinationId")
    );

as the DestinationId column is there. But the column type is serial instead of int. I can live with that, but it's something you might like to look into.

FluentNHibernate 2.1.2

hazzik added a commit that referenced this issue Apr 2, 2024
@hazzik hazzik added the bug label Jul 10, 2024
@hazzik hazzik added this to the v3.4.0 milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants