nhibernate-3

Can I use NHibernate SysCache with Non-Web-Application?

风流意气都作罢 提交于 2020-01-05 04:39:07
问题 I have a Windows Service which is using NHibernate (3) and SQL Server 2008. WPF-Clients are connecting over WCF to this Service for using DataAccess. My question is now: Can I use SysCache or SysCache2 in this Scenario - or are they only usable in Web-/ASP.NET-Applications? 回答1: Yes, it works just fine. You can use it even in a console app if you want to (provided the computer has the full .NET Framework installed and not just the Client Profile). 来源: https://stackoverflow.com/questions

Fluent NHibernate - IndexOutOfRange

…衆ロ難τιáo~ 提交于 2019-12-23 10:01:23
问题 I've read all the posts and know that IndexOutOfRange usually happens because a column is being referenced twice. But I don't see how that's happening based on my mappings. With SHOW_SQL true in the config, I see an Insert into the Events table and then an IndexOutOfRangeException that refers to the RadioButtonQuestions table. I can't see the SQL it's trying to use that generates the exception. I tried using AutoMapping and have now switched to full ClassMap for these two classes to try to

What is the difference between ISession.SaveOrUpdateCopy() and ISession.Merge()?

廉价感情. 提交于 2019-12-22 05:26:12
问题 In NHibernate 3.1, ISession.SaveOrUpdateCopy() has been marked as deprecated. The documentation suggests using Merge() instead. The documentation for each is as follows: SaveOrUpdateCopy(object obj) Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved or does not exist in the database, save it and

Breaking changes with NHibernate 4 upgrade

我们两清 提交于 2019-12-19 03:45:20
问题 I can see what's new and fixed in NHibernate 4.0 I would like to know if anyone has had issue with hbm mappings upgrading from NHibernate 3 to 4? I fear that more focus is going on fluent mapping these days. I can test for the more obvious breaking changes but wanted to know if there were any subtle issues that anyone has come across in a production environment that may not be so obvious at first. It looks like a major upgrade and you'd expect there to be the risk of regressions. 回答1: I

How to do a conditional Sum with Nhibernate?

℡╲_俬逩灬. 提交于 2019-12-19 03:12:28
问题 I'm trying to do the equivalent of this SQL Code SELECT ID SUM(CASE WHEN myProperty = 2 THEN 1 ELSE 0 END) as nbRowWithValueOf2, SUM(CASE WHEN myProperty = 3 THEN 1 ELSE 0 END) as nbRowWithValueOf3 FROM Foo GROUP BY ID With Nhibernate. So far I tried queryable = queryable .Select( Projections.Group<Foo>(c => c.ID), Projections.Sum<Foo>(c => c.myProperty == MyEnum.Two ? 1 : 0) Projections.Sum<Foo>(c => c.myProperty == MyEnum.Three ? 1 : 0) ) But this gives me the following error: Could not

LINQ-to-NHibernate: Cannot use Linq Skip() and Take() with FetchMany

匆匆过客 提交于 2019-12-14 02:06:54
问题 I have these entities: public class BlogPost { public virtual int Id { get; set; } public virtual IList<Keyword> Keywords { get; set; } public virtual IList<BlogComment> Comments { get; set; } } public class BlogComment { public virtual int Id { get; set; } public virtual BlogPost Post { get; set; } } public class Keyword { public virtual int Id { get; set; } public virtual IList<BlogPost> BlogPosts { get; set; } } I want to load a paged-list of BlogPost s by their Keyword s and comments

Is there a better implementation for SybaseDialect in Version 3.0 of NHibernate?

给你一囗甜甜゛ 提交于 2019-12-12 01:34:45
问题 We have upgraded to NHibernate 3.0 with Fluent-NHibernate. In version 2.1.2 we where able to use the SybaseDialect for ASE 12. In version 3.0 SybaseDialect for ASE 12 is not supported. I reused the old Dialect from Nhib 2.1.2 and all is working. What I wanted to ask since this one was removed as it was considered not a good implementation, is there a better one out there? Since it's working I am not sure what improvements need be made but I thought I would ask. 回答1: This blog post has the

Bound FetchMany in Linq to NHibernate

*爱你&永不变心* 提交于 2019-12-11 01:55:28
问题 I am using FetchMany for some of my queries and the NHibernate profiler gives me the following error: WARN: firstResult/maxResults specified with collection fetch; applying in memory! I guess this is because the fetch is unbound. Is there a solution to this? 回答1: This problem arises because using FetchMany will bring the whole result set to memory and then Take the specified subset (something inefficient and potentially dangerous). Apparently there is no way to limit the subset before

Meaning of 'Disabled ghost property fetching for <entity> because it does not support lazy at the entity level'

扶醉桌前 提交于 2019-12-10 23:30:28
问题 I have seen this warning in my NHibernate-DataAccess: 'Disabled ghost property fetching for entity because it does not support lazy at the entity level' Does someone know, what does this mean? - What does I have to change to solve this? Here is a mapping for an entity, which is causing this warning: public class BusinessTypeMap : ClassMap<BusinessType> { public BusinessTypeMap() { this.Table("BusinessType"); this.Version(x => x.ObjectVersion); this.Id(x => x.Id).GeneratedBy.Assigned(); this

NHibernate, map a collection where key can be two different columns

做~自己de王妃 提交于 2019-12-08 11:24:23
问题 There's an entity A . In addition, there's an entity B which has two associations with A . A has a collection of B . This collection must load any B if one of associated A is the parent of loaded A . Problem is collection mapping on A must filter children based on checking if one of two A associations is the parent one. How can I achieve that? Note: Order doesn't matter, so you can suggest some mapping using bag . Note 2: Please suggest how to achieve that using an XML mapping, I won't do it