I am creating a Fluent N hibernate subclass mapping that currently looks something like this:
public class TaskDownloadMap: SubclassMap<TaskDownload>
{
public TaskDownloadMap()
{
Table("TasksDownload");
Map(x => x.ExtraProperty1, "ExtraProperty1")
.Nullable();
Map(x => x.ExtraProperty2, "ExtraProperty2")
.Nullable();
}
}
When I try and save one of these entities I get an exception:
Test.TaskRepositoryTest.DeleteTest:
NHibernate.Exceptions.GenericADOException : could not insert: [TaskManager.Entities.TaskDownload#269][SQL: INSERT INTO TasksDownload (ExtraProperty1, ExtraProperty2, Task_id) VALUES (?, ?, ?)]
----> System.Data.SqlClient.SqlException : Invalid column name 'Task_id'.
It's because the Id column I have set on my subclass's table is named "TaskId". Is there some to override the default naming scheme that nhibernate is trying to use? I don't seem to have the ability to specify the "Id" column in the subclass and I can't find anyone else even talking about it.
The parent mapping looks like this:
public class TaskMap: ClassMap<Task>
{
public TaskMap()
{
Table("Tasks");
Id(x => x.Id, "Id")
.GeneratedBy.Identity();
.
.
.
}
}
Like I said before I am going with the Table-Per-Subclass strategy so these are 2 different tables. I can change the key on my TasksDownload table to be "Task_id" but I'd rather just be able to specify that it's "TaskId" in my mapping so I can keep to my naming convention.