nhibernate

How do I generate ids with NHibernate and Firebird?

天涯浪子 提交于 2020-01-06 02:49:08
问题 I'm trying to insert some new objects into a firebird database using NHibernate. I get the error "could not get next sequence value[SQL: SQL not available]" Here is the mapping I'm using at present. Note ANML_EVNT is the name of the generator I want to use. <id name="Id" column="ID" type="integer"> <generator class="sequence"> <param name="sequence">ANML_EVNT></param> </generator> </id> 回答1: If you still are looking for an answer here is how I've used it successfully. I use the "native"

NHibernate IsInsensitiveLike treats strings as case sensitive

那年仲夏 提交于 2020-01-05 19:54:09
问题 Hi I have to following code CurrentSession.QueryOver<Entity>() .WhereRestrictionOn(x => x.Name).IsInsensitiveLike(filterValue,MatchMode.Anywhere) .List() As far as I know the comparision should be case insensitive, however if the name is "Country" the word "country" won't return any matches. What is wrong in this code expression? Thanks, 回答1: There is too few information but in general - this should (almost must) work. This feature is implemented by InsensitiveLikeExpression.cs Here is the

NHibernate IsInsensitiveLike treats strings as case sensitive

假如想象 提交于 2020-01-05 19:53:20
问题 Hi I have to following code CurrentSession.QueryOver<Entity>() .WhereRestrictionOn(x => x.Name).IsInsensitiveLike(filterValue,MatchMode.Anywhere) .List() As far as I know the comparision should be case insensitive, however if the name is "Country" the word "country" won't return any matches. What is wrong in this code expression? Thanks, 回答1: There is too few information but in general - this should (almost must) work. This feature is implemented by InsensitiveLikeExpression.cs Here is the

NHibernate IsInsensitiveLike treats strings as case sensitive

瘦欲@ 提交于 2020-01-05 19:53:13
问题 Hi I have to following code CurrentSession.QueryOver<Entity>() .WhereRestrictionOn(x => x.Name).IsInsensitiveLike(filterValue,MatchMode.Anywhere) .List() As far as I know the comparision should be case insensitive, however if the name is "Country" the word "country" won't return any matches. What is wrong in this code expression? Thanks, 回答1: There is too few information but in general - this should (almost must) work. This feature is implemented by InsensitiveLikeExpression.cs Here is the

When to commit NHibernate Transaction?

这一生的挚爱 提交于 2020-01-05 12:16:13
问题 While very familiar to Webforms and Linq, I am a novice to the ASP.NET MVC and NHibernate World. I have been working through a project using Bob Cravens' examples. My application is mostly reads and non-sequential writes, so typically I would not use a transactions. But to implement the Unit-of-Work pattern, all my research including Ayende's blog says I should. The problem I have is this - Ninject creates a Session and Opens a Transaction. Ninject injects repositories into services, and

When to commit NHibernate Transaction?

我们两清 提交于 2020-01-05 12:16:12
问题 While very familiar to Webforms and Linq, I am a novice to the ASP.NET MVC and NHibernate World. I have been working through a project using Bob Cravens' examples. My application is mostly reads and non-sequential writes, so typically I would not use a transactions. But to implement the Unit-of-Work pattern, all my research including Ayende's blog says I should. The problem I have is this - Ninject creates a Session and Opens a Transaction. Ninject injects repositories into services, and

Fluent NHibernate HasMany Collection Problems

萝らか妹 提交于 2020-01-05 09:15:30
问题 Update: It appears that changing my mapping from Cascade.All() to Cascade.AllDeleteOrphan() fixes most of my issues. I still have to explicitly set the Company property on the OperatingState, which seems unnecessary as it's being added to the Company entity, but at least I can work with that during an update. I still need to test that with a create. If any one can explain that, that would be a big help. Update 2: After playing with it some more, it appears I don't always have to specify the

NHibernate will insert but not update after move to host with shared server running mysql

与世无争的帅哥 提交于 2020-01-05 08:24:14
问题 I have a site running MVC and Nhibernate (not fluent) using standard session per request in an http module, runs fine locally (also with mysql) but after a move to a hosting provider no update statements are being issued. I can insert but not update, no exceptions are raised, I have the 'show_sql' option switched on which locally shows the update statements being issued but on the server no update statements are logged. I don't think NHProf is an option for me as I can only run asp.net apps

nhibernate : executing updates in batches

好久不见. 提交于 2020-01-05 08:07:24
问题 I am trying to do batch updates using NHibernate, but it is not doing batch updates, its doing individual writes for all the rows. I have to write around 10k rows to db. using (var session = GetSessionFactory().OpenStatelessSession()) { session.SetBatchSize(100); using (var tx = session.BeginTransaction()) { foreach (var pincode in list) { session.Update(pincode); } tx.Commit(); } } I am tried setting batch size to 100 using session.SetBatchSize(100); but that does not help. Also tried

nhibernate : executing updates in batches

你。 提交于 2020-01-05 08:06:46
问题 I am trying to do batch updates using NHibernate, but it is not doing batch updates, its doing individual writes for all the rows. I have to write around 10k rows to db. using (var session = GetSessionFactory().OpenStatelessSession()) { session.SetBatchSize(100); using (var tx = session.BeginTransaction()) { foreach (var pincode in list) { session.Update(pincode); } tx.Commit(); } } I am tried setting batch size to 100 using session.SetBatchSize(100); but that does not help. Also tried