I am using the current Version 4.0.3 to map some MySQL tables. However, I already get problems on creating the mapping using an automapper! Reason: A byte array! As soon as I add an byte array like "byte()" (vb.net syntax) I get an exception:
"interface maps for generic interfaces on arrays cannot be retrived."
It seems that this exception comes more deeply from .NET I think but the thing is: I do not have this problem with Fluent nhibernate mapping! Fluent does map my byte array into a longblob which is what I expected to do. However, NHibernate 4 does not. Unfortunately Fluent is not clever enough to map my Id-Properties when they contain some description (e.g. "EmployeeId"). I would need to rename all my properties to "Id" to avoid mapping manually. So because of this I would like to use NHibernates automapper instead but it seems that it cannot handle any kind of array (I also tried using integer arrays as well, same exception). Does anybody have the same problem?? Here is my code:
Public Cfg As Configuration
Public Mapping As HbmMapping
Public SessionFactory As ISessionFactory
Public Sub New()
CreateConfig()
Map()
SessionFactory = Cfg.BuildSessionFactory()
End Sub
Public Sub CreateConfig()
Cfg = New Configuration()
Cfg.DataBaseIntegration(AddressOf DbIntegration)
End Sub
Private Shared Sub DbIntegration(c As IDbIntegrationConfigurationProperties)
c.ConnectionString = "Server=xxx;Port=3306;Database=xxx;User ID=xxx;Password=xxx;"
c.Driver(Of MySqlDataDriver)()
c.Dialect(Of MySQL55Dialect)()
c.LogSqlInConsole = True
c.LogFormattedSql = True
c.AutoCommentSql = True
End Sub
Public Sub Map()
Dim automapper As New ConventionModelMapper()
Mapping = automapper.CompileMappingFor(Assembly.GetExecutingAssembly().GetExportedTypes().Where(Function(x) x.[Namespace].StartsWith("xxx.Models")))
Cfg.AddMapping(Mapping)
End Sub
All this works fine for all my entities except the entities containing array. Actually the only array I need to use is the byte array in a single entity using byte array. I tried to override the mapping using BeforeMapProperty event, however the exception throws anyway because I think the error occurs before that event already.
Thanks! Best, Chris