DynamicComponent mapping question

55 views
Skip to first unread message

jclarknet

unread,
Dec 7, 2009, 12:17:55 PM12/7/09
to Fluent NHibernate
I'm playing around with DynamicComponent to see how we might use that
for user generated columns. (extensibility). So far I can easily
create the mapping correctly using the .hbm files but not with
fluent. I want to define custom fields of a specific type, and from
what I see if you just use the default config it tries to create a
varbinary field for any dynamic component. Furthermore, if you don't
try and give it a type it will throw an error something like:
{"property mapping has wrong number of columns:
TestConsole.Session.CustomFields type: component[TestField1]"}

Here is my sample code, how do i specify a datetime or string custom
field?

this.DynamicComponent(x => x.CustomFields,
c =>
{
c.Map(x => x["TestField1"]);
});

Once this is working properly, is there a way to add fields at
runtime? If so how :)

Thanks

Oliver Friedrich

unread,
Jul 6, 2011, 8:08:09 AM7/6/11
to fluent-n...@googlegroups.com
Two years later I'm using this which works just fine:

this.DynamicComponent(x => x.CustomFields, 
                c => 
                { 
                    c.Map("TestField1").CustomType(typeof(DateTime)); 
                });


Cheers, Oliver
Reply all
Reply to author
Forward
0 new messages