Exception: Paired field 'State.State' was not found in 'AbiturAd' type.

However I explicitly named the field so that the name "State.State" should not be used when resolving the field.

debugging info: alt text

at:

"Xtensive.Storage.DomainBuilderException: Paired field 'State.State' was not found in 'AbiturAd' type.\r\n at Xtensive.Storage.Building.Builders.AssociationBuilder.BuildPairedAssociation(AssociationInfo slave, String masterFieldName)\r\n at Xtensive.Storage.Building.Builders.ModelBuilder.BuildAssociations()\r\n at Xtensive.Storage.Building.Builders.ModelBuilder.BuildModel()\r\n at Xtensive.Storage.Building.Builders.ModelBuilder.Run()\r\n at Xtensive.Storage.Building.Builders.DomainBuilder.BuildModel()\r\n at Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration)\r\n at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage)\r\n at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)\r\n at Xtensive.Storage.Domain.Build(DomainConfiguration configuration)\r\n at NC.DataObjects.Database.BuildDomain() in D:\MyProjects\Checkout\NcPortal-do. net\NC.DataObjects\Database.cs:line 34\r\n at System.Lazy`1.CreateValue()"

Entities:

    [HierarchyRoot, Serializable]
    [TableMapping("States")]
    [KeyGenerator(KeyGeneratorKind.None)]
    public class State : Entity
    {
        [Key]
        [Field]
        public string ID { get; private set; }

        [Field]
        [Association(PairTo = "State")]
        public EntitySet<AbiturAd> AbiturAds { get; set; }
    }

    [HierarchyRoot, Serializable]
    [TableMapping("AbiturAds")]
    public class AbiturAd : Entity
    {
        [Key]
        [Field]
        public int ID { get; private set; }

        [Field]
        [FieldMapping("StateID")]
        public State State { get; set; }
    }

asked Aug 15 '10 at 11:50

tobi's gravatar image

tobi
13556

edited Sep 03 '10 at 16:27

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

What version / build number of DO4 to you use? Very similar issue was fixed in mid-July: http://code.google.com/p/dataobjectsdotnet/issues/detail?id=737

(Aug 16 '10 at 05:26) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Hello Tobi,

Try using the following workaround for now:

[Field]
[Association(PairTo = "AbiturAd.State")]
public EntitySet<AbiturAd> AbiturAds { get; set; }

Hope that helps. This issue happens because there is an internal property Persistent.State and therefore, arises a sort of conflict during compilation/domain model building process.

answered Aug 16 '10 at 07:55

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

edited Aug 16 '10 at 07:59

Thanks. I have found out that by myself from the debugger but I was wondering why only this specific field needed this workaround. I guess I will be noticing when the bug has been fixed ;-)

(Aug 16 '10 at 10:11) tobi tobi'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

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573
×120
×23

Asked: Aug 15 '10 at 11:50

Seen: 9,961 times

Last updated: Sep 03 '10 at 16:27

powered by OSQA