From c9398a4deee421d37f72130fa767342a385a6f73 Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Tue, 10 Jul 2018 11:24:52 +0300 Subject: [PATCH] Document IEntity.GetKeys() method. --- docs/Entities.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/Entities.md b/docs/Entities.md index 1777d9829b..56eb88315a 100644 --- a/docs/Entities.md +++ b/docs/Entities.md @@ -45,11 +45,18 @@ public class UserRole : Entity { } + + public override object[] GetKeys() + { + return new object[] { UserId, RoleId }; + } } ```` For the example above, the composite key is composed of `UserId` and `RoleId`. For a relational database, it is the composite primary key of the related table. +Entities with composite keys should implement the `GetKeys()` method as shown above. + Notice that you also need to define keys of the entity in your **object-to-relational mapping** (ORM) configuration. > Composite primary keys has a restriction with repositories. Since it has not known Id property, you can not use `IRepository` for these entities. However, you can always use `IRepository`. See repository documentation (TODO: link) for more.