fluent-nhibernate

Latest Binary builds of FLuentNhibernate + Nhibernate + Linq for NHibernate

喜欢而已 提交于 2019-12-06 05:26:03
问题 do people build there own versions of all this? or is there a place to get all this prebuilt? I got the latest FluentNhibernate which has NHibernate but no Linq.... but I don't really want to setup a ruby rake build system etc etc unless I really really have to! Prefer to just get all the binaries I need. 回答1: Here is a build: http://www.dennisdoomen.net/2009/07/nhibernate-210-ga-with-linq-and-fluent.html 回答2: I build my own versions, because I don't want to be forced to upgrade all the

FluentNHibernate Auto Mappings and ISet in .NET 4.0

孤人 提交于 2019-12-06 04:58:13
How to set up auto mapping to map System.Collections.Generics.ISet<T> correctly? I tried implementing IHasManyConvention , but in intellisense it seems that IOneToManyCollectionInstance does not have anything for that(?) This is not up to Fluent NHibernate, because NHibernate just doesn't have any built-in implementation for System.Collections.Generics.ISet<T> . If you really want to use .NET's ISet instead of Iesi.Collections, for now you'll have to write it yourself. Use PersistentGenericSet for reference. As far as I know, the only generic you can automap right out of the box (i.e. without

How to fix a NHibernate lazy loading error “no session or session was closed”?

廉价感情. 提交于 2019-12-06 04:54:43
问题 I'm developing a website with ASP.NET MVC, NHibernate and Fluent Hibernate and getting the error " no session or session was closed " when I try to access a child object. These are my domain classes: public class ImageGallery { public virtual int Id { get; set; } public virtual string Title { get; set; } public virtual IList<Image> Images { get; set; } } public class Image { public virtual int Id { get; set; } public virtual ImageGallery ImageGallery { get; set; } public virtual string File {

fluent NHibernate one-to-one relationship?

邮差的信 提交于 2019-12-06 04:08:06
I have a problem with one-to-one relationships in the fluent nHibernate. I have the following relational table from the AdventureWorks2008 database. BusinessEntity (Table) BusinessEntityId Int (PK, Identity) Person (Table) BusinessEntityId int (PK, Reference with BusinessEntity table) FullName varchar(255) The relationship between BusinessEntity table and Person table is one-to-one. How do I map fluently without any extra field like "Id" in the Person table? There should be 2 class one for Person and another for BusinessEntity, or an appropriate model to best describe the above relation.

Fluent NHibernate mapping IList<Point> as value to single column

☆樱花仙子☆ 提交于 2019-12-06 03:38:57
I have this class: public class MyEntity { public virtual int Id { get; set; } public virtual IList<Point> Vectors { get; set; } } How can I map the Vectors in Fluent NHibernate to a single column (as value)? I was thinking of this: public class Vectors : ISerializable { public IList<Point> Vectors { get; set; } /* Here goes ISerializable implementation */ } public class MyEntity { public virtual int Id { get; set; } public virtual Vectors Vectors { get; set; } } Is it possible to map the Vectors like this, hoping that Fluent NHibernate will initialize Vectors class as standard ISerializable?

one-to-one fluent nhibernate?

↘锁芯ラ 提交于 2019-12-06 03:33:38
问题 Is it possible yet to do a one-to-one mapping with fluent nhibernate? I have the following as part of an hbm that I'm trying to convert to fluent: <one-to-one name="Person" property-ref="FileData" constrained="true"/> I see a OneToOnePart<OTHER> in the code but i'm not sure how or if this is used to accomplish this. Thanks! 回答1: There is a HasOne mapping map => map.HasOne(x => x.Person) .PropertyRef(x => x.FileData) .Constrained(); I think that's what you're looking for. 来源: https:/

Fluent nHibernate - Mapping Children with Composite Keys Yielding Null References

岁酱吖の 提交于 2019-12-06 02:53:20
Given a simple parent -> child (CK,CK) setup like this .. I am having trouble with adding a new child object and it getting the parent reference. So I would add the object in such a way .. var parent = new Parent{ Children = new List<Child>{ new Child{ Other = otherReference } } }; Or even adding it using the Add() method... parent.Children.Add(new Child { Other = other }); The reference to the Parent does not get pushed through. It just ends up as a null property. I get the following exception. {"Cannot insert the value NULL into column 'ParentId', table 'mssql_test.Children'; column does not

How to set a configuration property when using fluent nhibernate?

徘徊边缘 提交于 2019-12-06 02:10:34
问题 In particular, I'd like to set current_session_context_class . I know how to do it in hibernate.cfg.xml, but is it possible at all with pure fluent configuration? 回答1: You can use the method ExposeConfiguration on a FluentConfiguration instance, to access the original NHibernate Configuration object. Then, you'll have access to the Properties property, and you will be able to add the current_session_context_class one. Here is a the pseudo-code: Fluently.Configure() .Database

Fluent Nhibernate - How to specify table name

流过昼夜 提交于 2019-12-06 01:56:19
I just started learning Nhibernate and Fluent Nhibernate. I want to specify table name when I create my mapping class. Entity name in application is "CustomerOrders" but in the oracle database, table name is "CUSTOMER_ORDERS". I learnt from googling that I can use "WithTable" to specify database table name. I am not sure how to use it and where as Vs2008 didn't find the method. Thanks WithTable was renamed to Table for the 1.0 release. It was mentioned in the release notes (first bullet point). public class CustomerOrdersMap : IAutoMappingOverride<CustomerOrders> { public void Override

Handling a one-to-many relationship with value types in Fluent NHibernate

£可爱£侵袭症+ 提交于 2019-12-06 01:21:40
I'm working on migrating an application to NHibernate, and I'm using Fluent NHibernate. I'm running into an issue mapping a collection of value types to an aggregate root. I have a PhoneNumber value type that has a few properties — Number , NumberType , and Description . There are a number of objects in my domain that have collections of phone numbers. In the database (SQL 2008), these values are held in different tables. So I might have Customers and CustomerPhoneNumbers as well as Vendors and VendorPhoneNumbers . The phone number tables are identical except for the foreign key that relates