How does the EntityLinker work?

The EntityLinker looks at both objects and determines what type of relationship they have.

  • For one-to-one relationships, the EntityLinker sets the backing field for both ends of the relationship (so that the properties don't fire)
  • For one-to-many/many-to-one relationships, the EntityLinker sets the backing field on the single end, and calls the Add(item, OperationArgs) on the many end
  • For many-to-many relationships, the EntityLinker calls the Add(item, OperationArgs) on both entities.

To prevent recursive calls, the EntityLinker tries to bypasse the property setters and IEntityList event handlers.

Unfortunately, this means that custom logic might be ignored - if you need to add custom logic during the linking operation, you may need use an alternative to the EntityLinker.

Search Knowledge Base

Have a question? Ask here.

Your name * Your email address * Your question/comment*