illegal access to loading collection

Mark's Avatar

Mark

20 Jul, 2010 08:19 AM via web

I have this error in the collection CategoryTranslated of class Category: illegal access to loading collection

public class Category : Entity
{

public Category()
{
    CategoriesTranslated = new List<CategoryTranslated>();

}

public virtual Category Parent { get; set; }
public virtual string Name { get; set; }
public virtual IList<CategoryTranslated> CategoriesTranslated { get; set; }

}

public class CategoryTranslated : Entity
{

public CategoryTranslated()
{
}

public virtual Category Category { get; set; }
public virtual LanguageType Language { get; set; }
public virtual string Name { get; set; }

}

public void Override(AutoMapping mapping)

{
    mapping.HasMany(x => x.CategoriesTranslated)
        .Inverse()
        .Cascade.All();

}

public void Override(AutoMapping mapping)

{
    mapping.References(x => x.Category);
}

Where is it wrong? thank you

  1. Support Staff 2 Posted by James Gregory on 22 Jul, 2010 11:04 AM

    James Gregory's Avatar

    What's the full exception?

  2. 3 Posted by Andrea on 22 Jul, 2010 12:24 PM

    Andrea's Avatar

    I found the solution.
    It was the LanguageType enum that was not configured correctly.
    Thank you to all

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What is the opposite of north?