I also have similar problem, I am very much new to this hibernate & fluent hibernate.
My table schema is like below
CREATE TABLE [dbo].[MyChildImmunisations](
[Child_id] [int] NOT NULL,
[Schedule_id] [int] NOT NULL,
[Status] [int] NOT NULL,
CONSTRAINT [PK_MyChildImmunisations] PRIMARY KEY CLUSTERED
(
[Child_id] ASC,
[Schedule_id] ASC
))
My mapping class code like below.
protected MyChildImmunisationMap(string tableName)
{
Table(tableName);
CompositeId()
.KeyReference(ci => ci.Child.Id, "Child_id")
.KeyReference(ci => ci.Schedule.Id, "Schedule_Id");
Map(ci => ci.Status).CustomType<childimmunisationstatus>();
}</childimmunisationstatus>