fluent-nhibernate

Fluent NHibernate and composite ID with single column name

萝らか妹 提交于 2019-12-30 09:55:13
问题 I've crossed posted this in the FNH Google Group but here's the scoop: I have a table in a legacy database that has a composite ID. Well, the PK is implied since the table doesn't actually have a PK defined, but the natural PK is the combination of the WORKORDERID and IMAGEPATH columns: CREATE TABLE [WORKORDERIMG]( [WORKORDERID] [varchar](50) NULL, [IMAGEPATH] [varchar](250) NULL, [WOTASKID] [numeric](10, 0) NULL, [ATTACHEDBY] [nvarchar](100) NULL, [COMMENTS] [nvarchar](256) NULL,

NHibernate mappings issue when referencing class (lazy load issue?)

柔情痞子 提交于 2019-12-30 06:57:39
问题 I'm using NHibernate + Fluent to handle my database, and I've got a problem querying for data which references other data. My simple question is: Do I need to define some "BelongsTo" etc in the mappings, or is it sufficient to define references on one side (see mapping sample below)? If so - how? If not please keep reading.. Have a look at this simplified example - starting with two model classes: public class Foo { private IList<Bar> _bars = new List<Bar>(); public int Id { get; set; }

NHibernate mappings issue when referencing class (lazy load issue?)

此生再无相见时 提交于 2019-12-30 06:57:07
问题 I'm using NHibernate + Fluent to handle my database, and I've got a problem querying for data which references other data. My simple question is: Do I need to define some "BelongsTo" etc in the mappings, or is it sufficient to define references on one side (see mapping sample below)? If so - how? If not please keep reading.. Have a look at this simplified example - starting with two model classes: public class Foo { private IList<Bar> _bars = new List<Bar>(); public int Id { get; set; }

SQLite: sqlite3.dll vs System.Data.SQLite.dll?

跟風遠走 提交于 2019-12-30 06:53:07
问题 What do I need to use SQLite with NHibernate (and FluentNHibernate ) ? There is: System.Data.SQLite.dll and System.Data.SQLite.Linq.dll , (ADO.NET 2.0 provider) available from http://sourceforge.net/projects/sqlite-dotnet2/ and sqlite3.dll available as binary download http://www.sqlite.org/download.html What is the difference? Do I need both, or which one? The first option installs to C:/...Program Files. Can I copy it from there to my custom SharedLibs folder, or will something reference the

Fluent nHibernate Slow Startup Time

▼魔方 西西 提交于 2019-12-30 06:42:06
问题 I am using Fluent NHibernate and I like it ! I am having a little issue: The startup time is about 10 seconds and I don´t know how to optimize Fluent nHibernate To make this startup time less problematic, I put it on a Thread. Could somebody tell a solution to this? And reply with the code below modified to make the performance improvement? I saw something like this on: http://nhforge.org/blogs/nhibernate/archive/2009/03/13/an-improvement-on-sessionfactory-initialization.aspx but I don´t know

Inner or Right Outer Join in Nhibernate and Fluent Nhibernate on Many to Many collection

馋奶兔 提交于 2019-12-30 06:39:28
问题 How can I force NHibernate to do a RIGHT outer join or an INNER join instead of a LEFT outer join on a many to many collection? The reason I would want to do this is because of filtering applied to the collection elements. With a left join, you get the same number of rows returned as an unfiltered query, but the elements that are filtered out just show NULL for all of the fields. However, with a right join, the correct number of rows and elements are returned from the query. I would expect

NHibernate - Execute SQL to populate DTO

六月ゝ 毕业季﹏ 提交于 2019-12-30 06:34:28
问题 I have some instances for reporting where executing sprocs is easier and simpler than complicated QueryOver statements. I have a DTO, not an entity, that represents the data returned from the query and want to populate the results of the query into the DTO. I am using named queries and session.GetNamedQuery() to execute the query. Do I have to create mapping files for the DTO? If so, is is possible to let NHibernate/FluentNHibernate know that it should not create tables for the DTO? My units

Mapping a List<string> to a delimited string with Fluent NHibernate

好久不见. 提交于 2019-12-30 02:28:09
问题 My model looks something like this: public class Product { public string Name {get; set;} public string Description {get; set;} public double Price {get; set;} public List<string> Features {get; set;} } I want my database table to be flat - the List should be stored as a delimited string: Feature one|Feature two|Feature three for example. When retrieved from the db, it should place each of those items back into a List Is this possible? 回答1: I'm doing the very same in my current project, only

Prevent Nhibernate schemaexport from generating foreign key constraints on has many relationship

社会主义新天地 提交于 2019-12-29 05:18:26
问题 I have a mapping like this: HasMany(x => x.Orders).KeyColumn("CustomerID"); Which is causing a constraint like this to be generated by schemaexport: alter table [CustomerOrder] add constraint FK45B3FB85AF01218D foreign key (CustomerID) references [Customer] I have tried adding .NotFound.Ignore() like on a References() mapping to disable the constraint from being generated but this does not work. Can a mapping be defined that will force SchemaExport to not generate the constraint? 回答1: Figured

Fluent NHIbernate automapping of List<string>?

二次信任 提交于 2019-12-29 04:42:20
问题 Fluent NHibernate doesn't like this, throwing an error: {"Association references unmapped class: System.String"} OK fine, I can see why this would cause a problem - but what's the best solution? I don't really want it to store a delimited list of strings in a single field, this would get ugly if my list contains many strings. I also don't really want a table 'string', for obvious reasons. I guess I can solve this by wrapping my List<string> inside a class, but this feels a little heavyweight.