nhibernate

Improving the performance of an nHibernate Data Access Layer

别来无恙 提交于 2020-01-01 12:00:13
问题 I am working on improving the performance of DataAccess Layer of an existing Asp.Net Web Application. The scenerios are. Its a web based application in Asp.Net. DataAccess layer is built using NHibernate 1.2 and exposed as WCF Service. The Entity class is marked with DataContract. Lazy loading is not used and because of the eager-fetching of the relations there is huge no of database objects are loaded in the memory. No of hits to the database is also high. For example I profiled the

What is the difference between NHibernate.Mapping.ByCode.Conformist.ClassMapping and FluentNHibernate.Mapping.ClassMap?

耗尽温柔 提交于 2020-01-01 10:07:52
问题 I'm learning about NHibernate, where the class mapping, I learned, is done with XML. I understand that Fluent NHibernate came about as a strongly-typed replacement for the XML-style of mapping. Indeed, here is the fluent-nhibernate tag description: Fluent NHibernate lets you write NHibernate mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code. Then later I was using NHibernate Mapping Generator to create mappings and domain classes

Nhibernate session.BeginTransaction() vs. transaction.Begin()

时光总嘲笑我的痴心妄想 提交于 2020-01-01 10:01:37
问题 My question is related to use of nhibernate transactions Is the transaction.Begin() below a problem? or just redundant? using (var transaction = session.BeginTransaction()) { transaction.Begin(); action(); transaction.Commit(); } 回答1: After checking the source, transaction.Begin() is in fact redundant - a harmless no-op. link to source 回答2: beginTransaction as it states begins a transaction, on the other hand session.Transaction will return the current active transaction if null will create

Nhibernate session.BeginTransaction() vs. transaction.Begin()

雨燕双飞 提交于 2020-01-01 10:00:09
问题 My question is related to use of nhibernate transactions Is the transaction.Begin() below a problem? or just redundant? using (var transaction = session.BeginTransaction()) { transaction.Begin(); action(); transaction.Commit(); } 回答1: After checking the source, transaction.Begin() is in fact redundant - a harmless no-op. link to source 回答2: beginTransaction as it states begins a transaction, on the other hand session.Transaction will return the current active transaction if null will create

NHibernate 3 lazy properties and eager queries

[亡魂溺海] 提交于 2020-01-01 09:53:22
问题 I'm using NHibernate 3.0.0 and the new feature lazy properties. However, in some queries I want to eagerly load the properties and I would like the query to result in non-proxied entity instances. I also prefer to use the LINQ provider or QueryOver. So my two questions related to this are: I know that eager loading of properties can be achieved in HQL with "fetch all properties" but is it possible to do the same with the LINQ provider or QueryOver? If I execute an HQL query with "fetch all

NHibernate 3 lazy properties and eager queries

廉价感情. 提交于 2020-01-01 09:52:49
问题 I'm using NHibernate 3.0.0 and the new feature lazy properties. However, in some queries I want to eagerly load the properties and I would like the query to result in non-proxied entity instances. I also prefer to use the LINQ provider or QueryOver. So my two questions related to this are: I know that eager loading of properties can be achieved in HQL with "fetch all properties" but is it possible to do the same with the LINQ provider or QueryOver? If I execute an HQL query with "fetch all

NHibernate 3 lazy properties and eager queries

亡梦爱人 提交于 2020-01-01 09:52:28
问题 I'm using NHibernate 3.0.0 and the new feature lazy properties. However, in some queries I want to eagerly load the properties and I would like the query to result in non-proxied entity instances. I also prefer to use the LINQ provider or QueryOver. So my two questions related to this are: I know that eager loading of properties can be achieved in HQL with "fetch all properties" but is it possible to do the same with the LINQ provider or QueryOver? If I execute an HQL query with "fetch all

NHibernate bulk insert or update

做~自己de王妃 提交于 2020-01-01 09:27:06
问题 Hi I'm working a project where we need to process several xml files once a day and populate a Database with the information contained in those files. Each file is roughly 1Mb and contains about 1000 records; we usually need to process between 12 and 25 of these files. I've seen some information regarding bulk inserts using NHibernate but our problem is somehow trickier since the xml files contain new records mixed with updated records. In the xml there is a flag that tells us is a specific

NHibernate exception: Transaction not connected, or was disconnected

醉酒当歌 提交于 2020-01-01 08:21:35
问题 In our develop environment all the ASP.NET application works just fine. However, when I deploy the site on the test machine, on some pages I get this exception: NHibernate.TransactionException: Transaction not connected, or was disconnected at NHibernate.Transaction.AdoTransaction.CheckNotZombied() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Transaction\AdoTransaction.cs:line 406 at NHibernate.Transaction.AdoTransaction.Rollback() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Transaction

Expression trees - unnecessary conversion to int32

↘锁芯ラ 提交于 2020-01-01 08:21:23
问题 Expression trees seem to build an unnecessary conversion when working with bytes and shorts, they convert both sides (in binary expressions for instance) to int32. This is an issue in some Linq providers that I've seen, each has to peel this redundant layer to get to the original expression. (NHibernate doesn't remove this layer and creates an awful CAST in the SQL query). // no conversion Console.WriteLine((Expression<Func<int, int, bool>>) ((s, s1) => s == s1)); // converts to int32 Console