I need batch insert for performance improvement. I have implemented HiLo for primary key generation. When i am inserting data using ISession its working good. But when i am trying to use IStatelessSession then i am getting an error "Cannot insert null value into table in *Id* column". That is when i am trying to batch insert system not considering HiLo its expecting to supply the id. *What may the problem?*
StateLess connection open code ---------------------------------------- public static IStatelessSession OpenEngineSession(bool isWeb = true) { lock (_lock) { if (defaultSession == null) { _assemblies = _assemblies ?? new List<Assembly>(); var assemblies = isWeb ? Directory.GetFiles(HttpContext.Current.Server.MapPath("~/bin"), "Leah.*.dll", SearchOption.TopDirectoryOnly) : Directory.GetFiles(Path.GetDirectoryName(Assembly.GetAssembly(typeof(GenericRepository)).Location), "Leah.*.dll", SearchOption.TopDirectoryOnly); assemblies.ForEach(x => { var assembly = Assembly.LoadFrom(x); if (assembly.GetTypes().Any(t => t.GetCustomAttributes<IsModelAttribute>(true).Any())) _assemblies.Add(assembly); }); if (_persistenceModel == null) { _persistenceModel = AutoMap.Assemblies(_assemblies.ToArray()) .Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never()) .Conventions.Add(FluentNHibernate.Conventions.Helpers.ForeignKey.EndsWith("Id")) .Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultCascade.Delete()) .Where(x => x.GetCustomAttributes<IsModelAttribute>(true).Any() || x.BaseType.GetCustomAttributes<IsModelAttribute>(true).Any()); foreach (var assembly in _assemblies) { _persistenceModel = _persistenceModel.UseOverridesFromAssembly(assembly); } _persistenceModel.AddFilter<TenantFilter>(); } if (_config == null) _config = GetConfig(); defaultSession = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008.ConnectionString(_config).Dialect<RegisterSqlFunctionHelper>) .Mappings(m => m.AutoMappings.Add(_persistenceModel)) .BuildSessionFactory(); } return defaultSession.OpenStatelessSession(); } } -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibernate+unsubscr...@googlegroups.com. To post to this group, send email to fluent-nhibernate@googlegroups.com. Visit this group at http://groups.google.com/group/fluent-nhibernate. For more options, visit https://groups.google.com/d/optout.