nhibernate

SQLite “Database is locked” error in multithreads application

时光怂恿深爱的人放手 提交于 2020-01-01 03:25:20
问题 There is a multithreads application, that works with large DB file (>600 Mb). "Database is locked" problem started when I added blob data, and started operate with >30 Kb of BLOB data per request. I think problem related to small HDD speed. It looks like SQLite deletes -journal file, one thread of my application got out of lock (because -journal file was applied and deleted), and other my thread want to do smth with DB, but SQLite still updates DB file... Sure, I can do a minute delays after

HasOne vs References Mapping Fluent NHibernate

不羁岁月 提交于 2020-01-01 02:53:06
问题 This is the first time I am working with FluentNhibernate Mapping and facing a question of how to reference another table. Any help is appreciated: I have several tables named CD_ varname and all these contain two columns - CODE and DESCR. I have one main table called Recipient and it has, say two columns, called ALIVE and SEX, both are of type number, and they reference to the tables CD_ALIVE and CD_SEX. If Alive=1 in the Recipient, then we need to get the code and descr from CD_ALIVE table

Fluent NHibernate + multiple databases

旧巷老猫 提交于 2020-01-01 02:41:27
问题 My project needs to handle three databases, that means three session factories. The thing is if i do something like this with fluent nhibernate: .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly())) the factories would pick up all the mappings, even the ones that correspond to another database I've seen that when using automapping you can do something like this, and filter by namespace: .Mappings(m => m.AutoMappings.Add( AutoMap .AssemblyOf<Product>() .Where(t => t

how to achieve table per concrete class when base class is abstract in fluent nhibernate?

这一生的挚爱 提交于 2020-01-01 02:38:26
问题 i have the following scenario public abstract class BaseClass { public virtual int Id {get; set}; public virtual string Name {get; set;} } public class FirstSubClass : BaseClass { //properties and behaviour here } public class SecondSubClass : BaseClass { //properties of SecondSubclass Here } public class ProcessStep { public virtual IList<BaseClass> ContentElements {get; set;} } for mapping i have used following code snippet :- this._sessionFactory = Fluently.Configure().Database

NHibernate - Wrong Columns on Queries

北慕城南 提交于 2019-12-31 22:21:36
问题 I'm getting an intermittant problem with NHibernate where it generates a query for an entity, but replaces one of the columns with a column from completely different (and unrelated) entity. It only ever replaces a single column, and is generally solved by restarting the application (though sometimes it takes a couple of attempts). ASP.NET application (.NET 4.0) SessionFactory created during Application_Start NHibernate 3.3.1- All mappings/configuration done via Mapping By Code Using

How to do subqueries in nhibernate?

非 Y 不嫁゛ 提交于 2019-12-31 20:14:14
问题 I need to do a subquery on a sub collection but I can't get it to work. I tried this Task tAlias = null; List<Task> result = session.QueryOver<Task>(() => tAlias) .Where(Restrictions.In(Projections.Property(() => tAlias.Course.Id), courseIds)) .WithSubquery.WhereExists(QueryOver.Of<CompletedTask>().Where(x => x.Student.StudentId == settings.StudentId)) ().ToList(); Yet I get Cannot use subqueries on a criteria without a projection. 回答1: session.QueryOver<Task>(() => tAlias)

NHibernate 1.2 in a .NET 4.0 solution

余生颓废 提交于 2019-12-31 13:16:08
问题 I have some projects based on NHibernate 1.2 and I'd like to add them to a .NET 4.0 solution, but I get an AmbiguousMatchException. No matter if these projects are targeted to 2.0 or 4.0 framework. It works if I add them to a .NET 3.5 solution. Does anyone have experience with that? Here is the exception: [AmbiguousMatchException: Ambiguous match found.] System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types,

Class Map Generator for Fluent NHibernate

三世轮回 提交于 2019-12-31 08:44:19
问题 Is there a Class Map generator for Fluent NHibernate? I need something like db2hbm but I want it to generate Fluent Class Maps instead of xml mappings. I am aware of AutoMapping for Fluent but that is not what I want. I want to be able to generate Class Map files from tables in database and push them to my src repository. 回答1: You can do this with NHibernate Mapping Generator. 回答2: You can do this with Visual NHibernate. Check the Fluent Nhibernate option on the Options screen to create FNH

NHibernate Definitive Cascade application guide

霸气de小男生 提交于 2019-12-31 07:57:26
问题 Are there any internet resources that have a definitive guide to all of the cascade settings for NHibernate that will include examples of the class structure, HBM and the implications of actions with each of the cascade settings for all of the relationships with NH. Also it would be helpful if there were examples for common associations to be done in the most correct manner such as setting up a states table that you will never end up cascade deleting a state, or that deleting an object that

NHibernate Definitive Cascade application guide

牧云@^-^@ 提交于 2019-12-31 07:57:14
问题 Are there any internet resources that have a definitive guide to all of the cascade settings for NHibernate that will include examples of the class structure, HBM and the implications of actions with each of the cascade settings for all of the relationships with NH. Also it would be helpful if there were examples for common associations to be done in the most correct manner such as setting up a states table that you will never end up cascade deleting a state, or that deleting an object that