I have the following class (simplefied)

class Article : Content {

        [Association(PairTo = "RelatedArticles")]
        public EntitySet<Article> RelatedArticles { get; private set; }

This is giving the following error on domain build, searched the forum, but I do not know what the problem is:

TestFixture failed: System.TypeLoadException : Access is denied: 'Xtensive.Storage.Internals.EntitySetItem2[NNet.Model.Content.Article.Article,NNet.Model.Content.Article.Article]'. at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module) at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() at System.Reflection.Emit.TypeBuilder.CreateType() at Xtensive.Core.Reflection.TypeHelper.CreateInheritedDummyType(String typeName, Type inheritFrom, Boolean implementProtectedConstructorAccessor) at Xtensive.Storage.Building.Builders.ModelBuilder.<BuildAuxiliaryTypes>b__2(String _underlyingTypeName, Type _genericInstanceType) at Xtensive.Core.Threading.ThreadSafeDictionary2.GetValueT 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) at NNet.Model.Test.AutoBuildTest.BuildDomain(DomainConfiguration configuration) in D:\Project\NNet-Web\NNet-Model-Test\AutoBuildTest.cs:line 37 at NNet.Model.Test.AutoBuildTest.TestFixtureSetUp() in D:\Project\NNet-Web\NNet-Model-Test\AutoBuildTest.cs:line 18

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

asked Jun 22 '10 at 18:41

Tony's gravatar image


One Answer:

stefmen wrote:

This should work!...

Make sure you have a [HierarchyRoot] identifier set on top of your class and a key field available.. This works for me!

My class looks like this (also simplified):

public class Program
        /// <summary>
        /// The identifier of the entity.
        /// </summary>
        [Key, Field]
        public Int32 Id { get; private set; }

        /// <summary>
        /// Program belongs to program
        /// </summary>
        public EntitySet<Program> Program { get; private set; }

otto wrote:

The problem is that the container class is not public. It also hapened to me, here is the issue: http://code.google.com/p/dataobjectsdot ... ail?id=698

Alex (Xtensive) wrote:

Btw, I suspect the issue can't be fixed: the problem here is that we generate a descendant of EntitySetItem<tmaster, tslave=""> to describe the relationship, where either TMaster or TSlave is substituted to non-public type.

Obviously, this can't work, and I don't know if there are any possible workarounds.

answered Jun 23 '10 at 06:28

Editor's gravatar image


Otto, thanks for analysis - it seems you're absolutely right.

(Jun 23 '10 at 06:28) Alex Yakunin Alex%20Yakunin's gravatar image

I found one possible way of resolving this: http://code.google.com/p/dataobjectsdot ... ?id=698#c3

(Jun 23 '10 at 06:28) Alex Yakunin Alex%20Yakunin'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


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



Asked: Jun 22 '10 at 18:41

Seen: 3,906 times

Last updated: Jun 22 '10 at 18:41

powered by OSQA