fluent-nhibernate

Fluent NHibernate BinaryBlobType

我们两清 提交于 2019-12-23 15:18:59
问题 today i'm working on a MySQL Database, and i don't know how to Map a Byte[] to a BLOB Column... My Table looks this way: CREATE TABLE `images` ( `Id` INT NOT NULL AUTO_INCREMENT , `imgText` VARCHAR(45) NULL , `image` BLOB NULL , PRIMARY KEY (`Id`) ); Mapping: public class imagesMap : ClassMap<images> { public imagesMap() { Id(x => x.Id); Map(x => x.imgText); Map(x => x.image).CustomType<BinaryBlobType>(); } } Buisnessobject: public class images { public virtual int Id{get;set;} public virtual

Mapping two references in the same class but reference class has Composite key

六月ゝ 毕业季﹏ 提交于 2019-12-23 12:43:42
问题 I have the following database tables (These are abbreviated for clarity): CREATE TABLE [dbo].[prod_uom]( [prod_id] [dbo].[uid] NOT NULL, --Primary key [uom_type] [numeric](9, 0) NOT NULL, --Primary Key ) CREATE TABLE [dbo].[order_line]( [order_line_id] [dbo].[uid] NOT NULL, --Primary key [prod_id] [dbo].[uid] NOT NULL, --Foreign key [uom_type_requested] [numeric](9, 0) NOT NULL, --Foreign key [uom_specified] [numeric](9, 0) NOT NULL --Foreign key ) Entity I'm having trouble with looks like

Fluent NHibernate mapping to a SQL Server CHAR(10) ID column

旧巷老猫 提交于 2019-12-23 12:32:28
问题 New to both NHibernate and Fluent NHibernate and I'm trying to resolve a performance problem in some inherited code caused by a conversion of a CHAR(10) column to NVARCHAR . From SQL Profiler: exec sp_executesql N'select mytestclas0_.LinkId as LinkId45_, mytestclas0_.Href as Href45_, mytestclas0_.LinkActive as LinkActive45_ from MessageLinks mytestclas0_ where mytestclas0_.LinkId=@p0',N'@p0 nvarchar(4000)',@p0=N'BzE2T48HMF' You can see the ID coming in from NHibernate is cast as a NVARCHAR .

key-many-to-one and key-property association: nhibernate won't DELETE items from set

耗尽温柔 提交于 2019-12-23 12:19:43
问题 I'll try to keep this terse, but hopefully won't miss any important information in my troubles. The code I believe provides all details, but I've left out the noise (it's VB, so there's lots of noise :) ). A "Case" object has many "Assignments": Public Class Case Property CaseId As Guid Property Assignments As ISet(Of CaseAssignment) End Class Public Class CaseAssignment Property Case As Case Property RoleId As Guid End Class The data model I've been handed looks about like what you'd expect,

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

Fluent nHibernate Join is doing insert into joined table

℡╲_俬逩灬. 提交于 2019-12-23 09:51:08
问题 I am trying to use join to pull in a single property from another table, which doesn't have a mapping. My problem is that when I create a new instance of my mapped entity and save it I get an error about trying to insert into my unmapped table (it's trying to insert null into a not null column). I thought using .ReadOnly() would stop nhibernate from trying to insert into my unmapped table but that doesn't seem to work. My mapping looks like this: // Join _UnMapped table with Mapped table to

Session is closed Object name: 'ISession'. at NHibernate.Impl.AbstractSessionImpl.ErrorIfClosed() - How to stop the session from closing prematurely

一世执手 提交于 2019-12-23 09:32:41
问题 I am using NHibernate in an MVC C# application with MySQL. I am trying to have multiple users access the session. I have been using .InRequestScope() on my session but i am still getting: System.ObjectDisposedException: Session is closed! Object name: 'ISession'. at NHibernate.Impl.AbstractSessionImpl.ErrorIfClosed() * ...or DataReader errors when i have my colleagues all navigate to the same page that accesses a Service at the same time. My IMasterSessionSource injection Bind

Mapping large string with Fluent NHibernate

痞子三分冷 提交于 2019-12-23 09:27:54
问题 I'm working with an Oracle DB, and I'm trying to map this class: public class Book { public virtual int Id { get; private set; } public virtual string Author { get; set; } public virtual string Title { get; set; } public virtual string Text { get; set; } } With this mapping class: public class BookMap : ClassMap<Book> { public BookMap() { Id(x => x.Id); Map(x => x.Author); Map(x => x.Title); Map(x => x.Text); } } But the column type that it generates me is NVARCHAR(255), And the Book.Text

Is it possible for nhibernate to return a query as an IDictionary instead of an entity class?

喜夏-厌秋 提交于 2019-12-23 07:55:53
问题 I have an entity Person: public class Person { public virtual int Id {get; set; } public virtual string FirstName { get; set; } public virtual string MiddleName { get; set; } public virtual string LastName { get; set; } } with the mappings: public class PersonMap { public PersonMap() { Table(TABLE_NAME); Id( x => x.Id); Map(x => x.FirstName).Not.Nullable(); Map(x => x.LastName).Not.Nullable(); Map(x => x.MiddleName).Not.Nullable(); } } There are some stuations where I would like Nhibernate to

NHibernate with Firebird… are these features enabled?

好久不见. 提交于 2019-12-23 07:47:57
问题 We're using NHibernate to great success with a Firebird backend. My question relates to the features available in NHibernate being supported by Firebird. If you have any expertise with Firebird and NHibernate your comments are welcome. Does Firebird support "Future" queries? From my reading it would appear that Firebird is one of a few databases that doesn't support this feature. Does anyone have a workaround as "Future" would be a good feature to utilise. Does Firebird support the NHibernate