In the CategoriesTranslated collection i have this error: 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<Category> mapping)
    {
        mapping.HasMany(x => x.CategoriesTranslated)
            .Inverse()
            .Cascade.All();

    }

  public void Override(AutoMapping<CategoryTranslated> mapping)
    {
        mapping.References(x => x.Category);
    }

//Db
CREATE TABLE Category(
[Id] smallint primary key identity(1,1),
 [Parent] smallint null, [Name] varchar(50) not null unique, )
 alter table [Category] add CONSTRAINT fk_Category_Category
FOREIGN KEY(Parent) references Category (Id)
go

CREATE TABLE CategoryTranslated(
[Id] smallint primary key identity(1,1),
[Category] smallint not null,
[Language] tinyint not null,
 [Name] varchar(50) not null, )

alter table [CategoryTranslated] add CONSTRAINT
fk_CategoryTranslated_Category
FOREIGN KEY(Category) references Category (Id) go
Where is it wrong? thank you

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to