private Configuration CreateConfiguration(NetworkCredential credential, GlobalPoco.Firma company) { var cfg = ConfigurationProvider.CreateConfiguration(credential, company); var userName = credential.UserName == ReadOnlyLogin.UserName ? "U0" : credential.UserName; var listener = new AuditEntityEventListener(userName); cfg.SetListener(ListenerType.PreUpdate, listener); cfg.SetListener(ListenerType.PreInsert, listener); var fluentConfig = Fluently.Configure(cfg) .Mappings(m => { foreach (var mappingAssembly in ConfigurationProvider.MappingAssemblies) { m.FluentMappings.AddFromAssembly(mappingAssembly); } }) .BuildConfiguration(); foreach (var classMapping in fluentConfig.ClassMappings) { classMapping.AddTuplizer(EntityMode.Poco, typeof(NullableTuplizer).AssemblyQualifiedName); } return(fluentConfig); }