fluent-nhibernate

many-to-one with multiple columns

自古美人都是妖i 提交于 2019-12-20 21:56:20
问题 I have a legacy data base and a relation one-to-one between two tables. The thing is that relation uses two columns, not one. Is there some way to say in nhibernate that when getting a referenced entity it used two columns in join statement, not one? I have a similar table structure TaskProgress ProgressId TaskId AssignmentId UserId Tasks TaskId AssignmentId TaskName Each task can be asigned in different assignments. That mean that unique task for task progress can be founded only by

many-to-one with multiple columns

半腔热情 提交于 2019-12-20 21:56:14
问题 I have a legacy data base and a relation one-to-one between two tables. The thing is that relation uses two columns, not one. Is there some way to say in nhibernate that when getting a referenced entity it used two columns in join statement, not one? I have a similar table structure TaskProgress ProgressId TaskId AssignmentId UserId Tasks TaskId AssignmentId TaskName Each task can be asigned in different assignments. That mean that unique task for task progress can be founded only by

Help with QueryOver and WhereExists

送分小仙女□ 提交于 2019-12-20 20:19:09
问题 I have a problem. I have Persons and Cats. Each Person has some Cats (there is a foreign key in Cats that points to the primary key in Persons). Each Cat has an Age. I want to select the Persons that have "Old" Cats. I want ALL the Cats of these persons, and not only the "Old" Cats. I need to do it with the QueryOver syntax. In T-SQL it would be something like: SELECT P.*, C.* FROM Persons P LEFT JOIN Cats C ON P.Id = C.OwnerId WHERE EXISTS ( SELECT 1 FROM Cats C2 WHERE P.Id = C2.OwnerId AND

Error with hilo in NHibernate - “could not read a hi value - you need to populate the table”

倾然丶 夕夏残阳落幕 提交于 2019-12-20 19:56:12
问题 I've genereated a schema for my (SQL 2005) db using SchemaExport, and it's created a table CREATE TABLE [dbo].[hibernate_unique_key]( [next_hi] [int] NULL ) ON [PRIMARY] When I try to add an entity, I get the error "could not read a hi value - you need to populate the table". What am I meant to do? edit: I've inserted a 1 into the table, and it seems to work. Is this the correct value to have in there? 回答1: NHibernate expects to find a value that stores the current hi value in that table, ie

Does Fluent-NHibernate support mapping to procedures?

耗尽温柔 提交于 2019-12-20 19:39:02
问题 I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects. Also is Fluent-NHibernate able to directly execute procedures with no result set returned? Basically I've been considering the implications of using Fluent-NHibernate to replace a dated TypedDataSet model with a domain driven design that can return simple objects from the DAL. If Fluent-NHibernate cannot work with

using (Fluent) NHibernate with StructureMap (or any IoCC)

半世苍凉 提交于 2019-12-20 10:54:28
问题 On my quest to learn NHibernate I have reached the next hurdle; how should I go about integrating it with StructureMap? Although code examples are very welcome, I'm more interested in the general procedure. What I was planning on doing was... Use Fluent NHibernate to create my class mappings for use in NHibs Configuration Implement ISession and ISessionFactory Bootstrap an instance of my ISessionFactory into StructureMap as a singleton Register ISession with StructureMap, with per-HttpRequest

To Multi-Tenant, or Not To Multi-tenant

廉价感情. 提交于 2019-12-20 09:55:39
问题 I have a difficult database design decision to make regarding multi-tenancy for the growing number of branches of my client's web-based CRM, which I actively maintain. I made the decision early on to use separate applications with separate databases for each branch, because it was the simplest way to cater for three different branches with disparate data and code requirements. I also wanted to avoid managing Tenant IDs in every query, like I had to with the legacy Classic ASP ( cringe )

Fluent NHibernate - Create database schema only if not existing

青春壹個敷衍的年華 提交于 2019-12-20 09:47:54
问题 I have an application where I use Fluent Nhibernate to create my database. This far I've been recreating the database schema each time. The code that does this is this: public NhibernateSessionFactory(IPersistenceConfigurer config) { _sessionFactory = Fluently.Configure(). Database(config). Mappings(m => m.FluentMappings.AddFromAssemblyOf<MappingsPersistenceModel>()). ExposeConfiguration(BuildSchema). BuildSessionFactory(); } private static void BuildSchema(Configuration config) { // if

How to get Fluent NHibernate working with NHibernate 3.x

血红的双手。 提交于 2019-12-20 09:39:39
问题 How to get Fluent NHibernate working with latest NHibernate 3.x trunk I got the following Exception : Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. EDIT : This exception occurs in FluentNhibernate file PersistanceConfiguration public TThisConfiguration Cache(Action<CacheSettingsBuilder> cacheExpression) { cacheExpression(cache); return (TThisConfiguration)this; } Don't understand, FluentNHibernate

How to get Fluent NHibernate working with NHibernate 3.x

怎甘沉沦 提交于 2019-12-20 09:39:00
问题 How to get Fluent NHibernate working with latest NHibernate 3.x trunk I got the following Exception : Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. EDIT : This exception occurs in FluentNhibernate file PersistanceConfiguration public TThisConfiguration Cache(Action<CacheSettingsBuilder> cacheExpression) { cacheExpression(cache); return (TThisConfiguration)this; } Don't understand, FluentNHibernate