Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
Castle Active Record Rookie Misteak - HasMany mapping woes

In trying to map a simple ISet<string> within an Active Record class my app kept bombing while trying to perform the SchemaExport during app initialization. Here's the error I get resulting from some call in ActiveRecordStarter.cs:

The given key was not present in the dictionary.

I knew this was related to the following property in my User class:

    Access = PropertyAccess.FieldCamelcase,
    RelationType = RelationType.Set
public virtual ISet<System.String> Roles
    get { return roles; }


Not until I went in to manually create my table did it dawn on me what I was missing:

    Element = "Role"

DOH! I should have gone and looked at other mappings I have created by hand before chasing this now it looks like:

    Access = PropertyAccess.FieldCamelcase,
    RelationType = RelationType.Set,
    Element = "Role"
public virtual ISet<System.String> Roles
    get { return roles; }


All is well again.

Posted 10-02-2007 2:11 PM by Michael Nichols



Christopher Steen wrote Link Listing - October 4, 2007
on 10-05-2007 4:09 AM

Link Listing - October 4, 2007

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)