Are dictionaries supported by the automapper?

96 views
Skip to first unread message

DanielT

unread,
Dec 23, 2009, 6:59:14 PM12/23/09
to Fluent NHibernate
I have an entity like so in a test project:

------------------------------------------------------------

public class Land {
public virtual IDictionary<string, int> Damages { get; set; }
}

------------------------------------------------------------

I'm using this code to try and automap it:

------------------------------------------------------------

var model = AutoMap.AssemblyOf<Land>().Where(t => t.Namespace ==
"Test.DomainModel");

Fluently.Configure()
.Database(SQLiteConfiguration.Standard.InMemory)
.Mappings(m => m.AutoMappings.Add(model)
.BuildSessionFactory();

------------------------------------------------------------

When I execute the configurer, I get the following exception:

"The type or method has 2 generic parameter(s), but 1 generic argument
(s) were provided. A generic argument must be provided for each
generic parameter."

A search on Google seems to indicate that this issue has been around
for a while now, but no solutions have turned up. Does the automapper
support dictionaries? Or is this a known issue that hasn't been
resolved yet?

marcus

unread,
Dec 26, 2009, 5:42:25 AM12/26/09
to Fluent NHibernate
I don't think the automapper supports dictionaries, I have asked the
question myself but I sadly did not get an answer.

Paul Batum

unread,
Dec 28, 2009, 6:47:13 AM12/28/09
to fluent-nhibernate
It's not supported. I estimate that none of the regular contributors
consider this a high priority so its unlikely to get attention any
time soon, unless a member of the community submits a patch.

> --
>
> You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
> To post to this group, send email to fluent-n...@googlegroups.com.
> To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>
>

James Gregory

unread,
Dec 28, 2009, 6:57:20 AM12/28/09
to fluent-n...@googlegroups.com
Aye, just use an IAutomappingOverride for the entity in question.

marcus

unread,
Dec 28, 2009, 10:00:17 AM12/28/09
to Fluent NHibernate
The problem is that I get an exception just by adding a dictionary in
my class and it does not even work to use the ignore property thingy

On 28 Dec, 12:57, James Gregory <jagregory....@gmail.com> wrote:
> Aye, just use an IAutomappingOverride for the entity in question.
>

> > fluent-nhibern...@googlegroups.com<fluent-nhibernate%2Bunsu...@googlegroups.com>


> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-n...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > fluent-nhibern...@googlegroups.com<fluent-nhibernate%2Bunsu...@googlegroups.com>

Paul Batum

unread,
Dec 30, 2009, 6:07:08 AM12/30/09
to fluent-nhibernate
Yeah unfortunately James, the automapping code just can't deal with a
member of a generic type with more than one argument. It doesn't get
anywhere near applying overrides.

Marcus, you should exclude the entire class from automapping and
fluently map it.

2009/12/29 marcus <mar...@meridium.se>:

> To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages