Convert .AsMap with KeyColumns to new Dictionary format

igitur's Avatar

igitur

25 Oct, 2010 11:30 AM via web

Hi,

I also need some help converting the .AsMap method to the new format.

Here is my old code:

HasMany(x => x.Claims)
            .KeyColumns.Add("SchemeCode", "MainMemberNumber")
            .AsMap(x => x.ChildNumber)
            .Cascade.AllDeleteOrphan()
            .Inverse();
  1. 2 Posted by igitur on 01 Nov, 2010 05:22 AM

    igitur's Avatar

    Please?

  2. Support Staff 3 Posted by James Gregory on 05 Nov, 2010 01:38 PM

    James Gregory's Avatar

    What are you stuck on in particular?

    The AsMap is unnecessary, as the HasMany(IDictionary) method you're using assumes it's a map. KeyColumns has become a ForeignKey closure (see below), and the rest is the same.

    .KeyColumns.Add("SchemeCode", "MainMemberNumber")

    Becomes

    .ForeignKey(key =>
    {
      key.Columns.Add("SchemeCode", "MainMemberNumber");
    })
  3. 4 Posted by igitur on 05 Nov, 2010 01:46 PM

    igitur's Avatar

    Thanks. It was the .KeyColumns part that boggled me.

    Is there perhaps an Old FNH -> New FNH conversion FAQ somewhere?

  4. Support Staff 5 Posted by James Gregory on 05 Nov, 2010 01:57 PM

    James Gregory's Avatar

    Not yet, but there will be for the 2.0 release.

    You should be aware that the master branch (and consequently the CI builds that are available on the site) are considered unstable; it's the branch that will eventually become 2.0, but that's quite a way-away yet, and will include many breaking changes.

    If you're wanting to keep on top of the bugfixes but don't want all the breaking changes, you should follow the v1.x branch instead. Binaries aren't currently available on the website (though you can get them from our CI system), but they will be before long.

    I'm looking to update the website very soon to make all this clear, as it's becoming obvious people might not be entirely aware what they're getting into when they're taking the CI builds from the website.

  5. 6 Posted by igitur on 07 Mar, 2011 10:12 AM

    igitur's Avatar

    Thanks.

    How do I specify which class property defines the dictionary key?

    The x => x.ChildNumber part. I saw there is a new .DictionaryKey() method, but it accepts only a column string, not a member expression.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    How many minutes are in an hour?