nhibernate

what does this error mean in nhibernate

偶尔善良 提交于 2019-12-23 06:49:08
问题 Out of the blue, i am getting this error when doing a number of updates using nhibernate. Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [MyDomainObject] there is no additional information in the error. Is there some recommended way to help identify the root issue or can someone give me a better explanation on what this error indicated or is a sympton around. Some additional info I looked at the object and all of the data looks fine, it has an ID,

what does this error mean in nhibernate

删除回忆录丶 提交于 2019-12-23 06:49:05
问题 Out of the blue, i am getting this error when doing a number of updates using nhibernate. Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [MyDomainObject] there is no additional information in the error. Is there some recommended way to help identify the root issue or can someone give me a better explanation on what this error indicated or is a sympton around. Some additional info I looked at the object and all of the data looks fine, it has an ID,

How do I serialize an NHibernate DetachedCriteria object?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 06:45:41
问题 I am looking for a solution to persist NHibernate DetachedCriteria objects to a database. I have tracked down the NHibernateUtil and the GetSerializable method, but I'm unsure how to use it to serialize a DetachedCriteria object. Any help on this would be greatly appreciated. Thank you. 回答1: DetachedCriteria is serializable and because it is not connected to a session, it should be doable by just doing regular .net object serialization as described here: http://msdn.microsoft.com/en-us

How do I serialize an NHibernate DetachedCriteria object?

寵の児 提交于 2019-12-23 06:45:11
问题 I am looking for a solution to persist NHibernate DetachedCriteria objects to a database. I have tracked down the NHibernateUtil and the GetSerializable method, but I'm unsure how to use it to serialize a DetachedCriteria object. Any help on this would be greatly appreciated. Thank you. 回答1: DetachedCriteria is serializable and because it is not connected to a session, it should be doable by just doing regular .net object serialization as described here: http://msdn.microsoft.com/en-us

Repository vs. UnitOfWork [closed]

对着背影说爱祢 提交于 2019-12-23 05:48:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . My current point of view is that repository should contain entity-specific modification methods like Add, Delete, etc. and UnitOfWork should contain just methods that are relevant to it in general like Commit (also known as SaveChanges, SubmitChanges) and Rollback (also known as ClearChanges). But Martin Fowler

Mask properties from dirty check

左心房为你撑大大i 提交于 2019-12-23 05:44:26
问题 I have a column in all my tables called LoggedInPersonID. To avoid cluttering mapping code, an Nhibernate Interceptor overrides OnFlushDirty and OnSave to assign the LoggedInPersonID property automatically. If LoggedInPersonID is the only property changed, I consider the entity clean. At the moment Nhibernate (rightfully) considers the entity to be dirty. Does any mapping construct exist to escape a property from Nhibernate's dirty check, while still including the column in any inserts

How can I get NHibernate to make a multicolumn table-valued parameter?

徘徊边缘 提交于 2019-12-23 05:27:50
问题 I'd like to pass a two-column table-valued parameter (TVP) to an ISQLQuery : var sql = "INSERT INTO MovieRatings (PersonID, MovieID, Score) " + "SELECT :personID, o.movieID, o.score " + "FROM :scoreObject o"; var query = session.CreateSQLQuery(sql); query.SetInt32("personID", fred.ID); query.SetParameterList("scoreObject", fredsRatings.Select(r => new { movieID = r.Movie.ID, score = r.Score }).ToArray() /*, Optional IType hint here */); query.ExecuteUpdate(); When I do this (or try to hint

Nhibernate transaction locks a tabel

白昼怎懂夜的黑 提交于 2019-12-23 05:27:49
问题 I have developed a WCF api which is using nHibernate. I am new to this. I have used session.update to take care of transaction. I have a for loop in which based on select condition I am updating a record ie. If A is present in tabel1 then I am updating the table else inserting a new entry. I am getting "could not execute query." when trying to execute a select query on a table which was previously being updated by adding a new entry in the table. What I think is, because I am using session

Enable referential integrity with nHIbernate using SQlite database

£可爱£侵袭症+ 提交于 2019-12-23 05:18:06
问题 Good evening everyone, I've got a project using nHibernate (2.1.2.4000) and System.Data.SQLite (1.0.66.0). I want to enforce NHibernate to create foreign keys when it creates the database or at least use the "foreign key" keyword then I'll be able to create the triggers. I googled but I didn't find any documentation on how to do that and I'm loosing the faith. I really don't want to (and I won't) check referential integrity inside my code. In a word: how do I enable referential integrity (or

using nHibernate with multi DB instances with DI

筅森魡賤 提交于 2019-12-23 05:16:30
问题 So I have multi db instances and One web application. depending on the url name, I know what db instance I need to talk to. I want to change the old ugly DAL to work with nhibernate and I want to use DI to do that. so, let say I have this class: class CompanyDal(ISession session) //nhibernate session { Save(ICompany company) { session.Save(company) } } so I am injecting the hibernate session when creating the DAL object. but my IOC needs to know which session to inject, meaning which