nhibernate

Mapping large string with Fluent NHibernate

痞子三分冷 提交于 2019-12-23 09:27:54
问题 I'm working with an Oracle DB, and I'm trying to map this class: public class Book { public virtual int Id { get; private set; } public virtual string Author { get; set; } public virtual string Title { get; set; } public virtual string Text { get; set; } } With this mapping class: public class BookMap : ClassMap<Book> { public BookMap() { Id(x => x.Id); Map(x => x.Author); Map(x => x.Title); Map(x => x.Text); } } But the column type that it generates me is NVARCHAR(255), And the Book.Text

nHibernate and SQL Server 2012 LocalDB

爷,独闯天下 提交于 2019-12-23 09:25:53
问题 Is it possible to use LocalDB databases with NHibernate? If yes, what should be installed/configured? Currently when trying to use connection string like Data Source=(LocalDb)\v11.0;Initial Catalog=tst1;Integrated Security=SSPI when creating SessionFactory I get System.Data.SqlClient.SqlException : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and

What is a suitable NHibernate / Iesi.Collections.Generic.ISet<T> replacement?

混江龙づ霸主 提交于 2019-12-23 09:10:59
问题 In the latest version of Iesi.Collections is missing Iesi.Collections.Generic.ISet. There seem to be three alternatives: LinkedHashSet ReadOnlySet SynchronizedSet Iesi.Collections.Generic.ReadOnlySet seems to be the closest to the ISet, and the documentation states: ... although it's advertised as immutable it really isn't. Anyone with access to the wrapped set can still change the set. It seems that the ReadOnlySet is the best replacement for the ISet? Currently the implementation is adding

Do I have to Load/Get an entity before SaveOrUpdate in Nhibernate?

删除回忆录丶 提交于 2019-12-23 08:08:21
问题 in my ASP.NET MVC application I've separated the domain model from the view model. I transform my entity in a viewmodel object so I can "feed" my views with only the data needed (I used valueinjecter for this purpose). During the save process my controller gets back the viewmodel object, transforms it into a domain model entity and try to persist it with SaveOrUpdate. I've noticed that if I try to update an existing record, Nhibernate considers it as a new object and forces an INSERT, even if

Can I use NHibernate's AdoNetTransactionFactory with distributed transactions?

瘦欲@ 提交于 2019-12-23 08:06:08
问题 I am dealing with a strange issue related to NHibernate and distributed transactions in a WCF service. See Deadlocks causing 'Server failed to resume the transaction' with NHibernate and distributed transactions for more details. One thing that seems to solve my problem is using NHibernate's AdoNetTransactionFactory, instead of AdoNetWithDistributedTransactionsFactory. I believe that the AdoNetWithDistributedTransactionsFactory is involved with making NHibernate's second-level caching

Is it possible for nhibernate to return a query as an IDictionary instead of an entity class?

喜夏-厌秋 提交于 2019-12-23 07:55:53
问题 I have an entity Person: public class Person { public virtual int Id {get; set; } public virtual string FirstName { get; set; } public virtual string MiddleName { get; set; } public virtual string LastName { get; set; } } with the mappings: public class PersonMap { public PersonMap() { Table(TABLE_NAME); Id( x => x.Id); Map(x => x.FirstName).Not.Nullable(); Map(x => x.LastName).Not.Nullable(); Map(x => x.MiddleName).Not.Nullable(); } } There are some stuations where I would like Nhibernate to

NHibernate with Firebird… are these features enabled?

好久不见. 提交于 2019-12-23 07:47:57
问题 We're using NHibernate to great success with a Firebird backend. My question relates to the features available in NHibernate being supported by Firebird. If you have any expertise with Firebird and NHibernate your comments are welcome. Does Firebird support "Future" queries? From my reading it would appear that Firebird is one of a few databases that doesn't support this feature. Does anyone have a workaround as "Future" would be a good feature to utilise. Does Firebird support the NHibernate

Random error when testing with NHibernate on an in-Memory SQLite db

筅森魡賤 提交于 2019-12-23 07:47:43
问题 I have a system which after getting a message - enqueues it (write to a table), and another process polls the DB and dequeues it for processing. In my automatic tests I've merged the operations in the same process, but cannot (conceptually) merge the NH sessions from the two operations. Naturally - problems arise. I've read everything I could about getting the SQLite-InMemory-NHibernate combination to work in the testing world, but I've now ran into RANDOMLY failing tests, due to "no such

Join Fetch: "query specified join fetching, but the owner of the fetched association was

折月煮酒 提交于 2019-12-23 07:36:58
问题 I have the following Model Activity with the language-depending property Title . The language-dependency is defined with two additional entities Translation (Title is of this type, many-to-one) and TranslationValue (one-to-many). If I write the following hql: from Activity act join fetch act.Title join fetch act.Title.TranslationValuesSet This works fine so far. But as soon as I add act into the select-statement, I've got a problem with the join of TranslationValuesSet: select act from

NHibernate query CreateCriteria

懵懂的女人 提交于 2019-12-23 06:49:30
问题 Is it possible to chose what columns I want in return from Session.CreateCriteria() ? egz.: var x = session.CreateCriteria(); x.CreateAlias("EmployeePosition", "employeePosition"); x.Add(Restrictions.Eq("employeePosition.Name", "Developer")); and is there a way to add something like "select LastName" to avoid downloading the whole row. 回答1: make a class that has only the properties you need, often this is a summary class like {Id, Label} and you'd reuse it anywhere you need a simple type, in