Hello,

With DO 3.X PairTo was allowed on persistent interfaces, but it seems it's not possible anymore with DO4.

[HierarchyRoot]
  public class MyEntity : Entity, IHasItem
  {
    [Field, Key]
    public int Id { get; private set; }

    [Field]
    [Association(PairTo = "Owner")]
    public EntitySet<Item> Items { get; set; }
  }

  public interface IHasItem : IEntity
  {
    EntitySet<Item> Items { get; set; }
  }

  [HierarchyRoot]
  public class Item : Entity
  {
    [Field, Key]
    public int Id { get; private set; }

    [Field]
    public IHasItem Owner { get; set; }
  }

Xtensive.Storage.DomainBuilderException was unhandled
  Message=Paired field for field 'MyEntity.Items' should be assignable to type 'MyEntity'.
  Source=Xtensive.Storage
  StackTrace:
       at Xtensive.Storage.Building.Builders.AssociationBuilder.BuildPairedAssociation(AssociationInfo slave, String masterFieldName)
       at Xtensive.Storage.Building.Builders.ModelBuilder.BuildAssociations()
       at Xtensive.Storage.Building.Builders.ModelBuilder.BuildModel()
       at Xtensive.Storage.Building.Builders.ModelBuilder.Run()
       at Xtensive.Storage.Building.Builders.DomainBuilder.BuildModel()
       at Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration)
       at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage)
       at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)
       at Xtensive.Storage.Domain.Build(DomainConfiguration configuration)

Am I missing something?

This is not an essential feature for us, but I thought I should give you the information.

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 26 '10 at 15:27

olorin's gravatar image

olorin
358848792

edited Sep 03 '10 at 15:39

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412


One Answer:

This really doesn't work currently.

v3.X supported quite flexible pairing, but there was a single pre-defined hierarchy structure. Currently you manage hierarchies by your own, but this makes implementing such pairing much harder for us. So we decided to support only "standard pairing" for now (AFAIK, it is anyway far more advanced then what other framework offer here).

answered Jul 28 '10 at 16:44

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

olorin wrote: Ok, in that case maybe you should just throw a more explicit exception.

We don't need this now, but maybe in the future...

(Jul 28 '10 at 16:44) Editor Editor's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA