Skip to content

Same column name in Id and in Many-To-One mapping causes error #2408

Closed
@heikar

Description

@heikar

Hi,

the following mapping fails because of the id column:

public class ArticleMap : ClassMapping<Article>
{
public Article()
{
Id(x => x.Id, x => x.Column("Id"));
Property(x => x.Name);
Property(x => x.Description);
ManyToOne(x => x.Dimensions, map => map.Name("Id"));
}
}

If i change it to:

public class ArticleMap : ClassMapping<Article>
{
public Article()
{
Id(x => x.Id, x => x.Column("Id"));
Property(x => x.Name);
Property(x => x.Description);
ManyToOne(x => x.Dimensions, map => map.Name("ID"));
}
}

it works for SELECT but for UPDATE and INSERT, the behavior is strange.

The generated INSERT command is: INSERT INTO Article (Name, Description, ID, Id) VALUES (?, ?, ?, ?).
The generated UPDATE command is: UPDATE Article SET Name = ?, Description = ?, ID = ? WHERE Id = ?.

Many greetings,
heikar

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions