Hello,
can someone please help me with the following problem:
I would like to store the class "MyPerson" in a single table with the rows "Name, IdPart1, IdPart2" and use IdPart1 and IdPart2 as the key for MyPerson. I do not know how to do it.
Example:
class MyPerson
property MyId MyId{get;set}
property string Name
class MyId
string IdPart1
string IdPart2
My Fluent API:
modelBuilder.Entity<Person>().ToTable("MyTable")
modelBuilder.CompleyType<MyId>().Property(p=>p.IdPart1).HasColumName("Part1");
modelBuilder.CompleyType<MyId>().Property(p=>p.IdPart2).HasColumName("Part2");
Now my table needs the key (this does not work):
modelBuilder.Entity<Person>().HasKey(p=>new {p.MyId.IdPart1, p.MyId.IdPart2})
Any idea how to manage it with the fluent api!?
Thank you very much!
Stephan