fluent-nhibernate

FluentNHibernate mapping of composite foreign keys

I have an existing database schema and wish to replace the custom data access code with Fluent.NHibernate. The database schema cannot be changed since it already exists in a shipping product. And it is preferable if the domain objects did not change or only changed minimally. I am having trouble mapping one unusual schema construct illu...

Fluent NHibernate ModifiedDate Version Convention

Hi, I am trying to create a fluent Nhibernate automap convention for all the modifiedDate property of my application where it should set the value to get the current date during UPDATE. I am trying the following and its not working. I want the SQL server to update the date. Please advice. public class ModifiedDateVersionConvention : IVe...

Fluently.Configure without explicitly entering types.

I'm trying to take my fluent mapping past the basic stuff that I've found here: http://wiki.fluentnhibernate.org/Fluent_configuration Where they explicitly add each type like this: ISessionFactory localFactory = Fluently.Configure() .Database( ObjectFactory.GetInstance<SybaseConfiguration>().GetSyba...

How does Fluent NHibernate support the Import Entity

I want to create a strongly type object from a fluent NHibernate query. If I were using HQL and NHibernate I belive I would need: the class for the output Namespace Model Public Class namecount Public Overridable Property lastname() as string ... Public Overridable Property lastnamecount() as integer ... Pu...

Fluent Nhibernate Table-Per-Entity Mapping with Composite Primary/Foriegn Keys

In .hbm.xml the mapping I am after would look as follows - any idea how I can reproduce this in Fluent NHibernate...? <class name="Dinosaur" table="Dinosaur" > <composite-id> <key-property name="Id" column="Id"/> <key-property name="Period" column="Period"/> </composite-id> <property name="DinosaurType" c...

Problem Upgrading NHibernate SQLite Application to .Net 4.0

I have a WPF Application using Fluent NHibernate 1.0 RTM and System.Data.SQLite 1.0.65 that works fine in .Net 3.5. When I try to upgrade it to .Net 4.0 everything compiles but I get a runtime error where the innermost exception is this: `The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be fou...

Is there an architecture/framework for desktop applications similar to S#arp archicture for web applications?

Is there any architecture or framework for Desktop applications similar to S#arp architecture for Web applications. S#arp Architecture uses Fluent NHibernate. ...

C# WCF Server retrieves 'List<T>' with 1 entry, but client doesn't receive it?! Please help Urgently.

Hi Everyone, I've been battling and trying to research this issue for over 2 days now with absolutely no luck. I am trying to retrieve a list of clients from the server (server using fluentNHibernate). The client object is as follow: [DataContract] //[KnownType(typeof(System.Collections.Generic.List<ContactPerson>))] //[KnownType(type...

What is the best way to provide an AutoMappingOverride for an interface in fluentnhibernate automapper

In my quest for a version-wide database filter for an application, I have written the following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using FluentNHibernate.Automapping; using FluentNHibernate.Automapping.Alterations; using FluentNHibernate.Mapping; using MvcExtensions.Model; using N...

FluentNHibernate: returning an enum from a derived property

I'm using the automapping feature of FluentNHibernate and need a property that derives its return value. This property must return an Enum value, e.g. public virtual MyEnum MyDerivedProperty { get { MyEnum retval; // do some calculations return retval; } } Currently I get the following exception: NHib...

fluent nHibernate mapping of subclassed structure

I have a workflow class that has a collection of phases, each phase has a collection of tasks. You can design a workflow that will be used by many engagements. When used in engagement I want to be able to add properties to each class (workflow, phase, and task). For example a task in the designer does not have people assigned, but a ta...

How to perform a execution time query using Linq to NHibernate

Hello, I am inserting a record into my table, but I want to be able to set my SortOrder field on insert to SELECT MAX(SortOrder) + 1 FROM Category WHERE SiteID = @SiteID. What is the easiest way of doing this? Here is my data structure: Category ID SiteID SortOrder Name I am using Fluent NHibernate and Linq to NHibernate. Thanks...

NHibernate and SetSessionAuth audit columns

We have audit columns set by triggers. For obscure security reasons predating my tenure and out of my control, we log in with a generic user, and do a 'set session authorization' to change the user to the db user of the user who is logged in. When we converted to NHibernate, it creates a whole new session and jacks everything up when we...

Fluent NHib causing visual studio 2010 hanging at runtime

Just installed and migrated a 2008 solution on Vista ultimate 64 and .net 4.0. Everything builds and tests run surprisingly well but I got the hang description below while trying to run the app under SQLite. It turns out that the hang has got something to do when the call is made for FNH to build the session factory during a run, the on...

Creating NONCLUSTERED INDEX on column by convention or fluent map

Hi, I want to use schemaExport to generate my Database. So, I would like some help as one of my table needs to have a non-clustered index on one column. Is there any way I can use the IIndexConvention to implement it? I could use a custom attribute to distinguee the property and then apply the convention for example. Many thanks. ...

NHibernate + Fluent long startup time

Hi all, am new to NHibernate. When performing below test took 11.2 seconds (debug mode) i am seeing this large startup time in all my tests (basically creating the first session takes a ton of time) setup = Windows 2003 SP2 / Oracle10gR2 latest CPU / ODP.net 2.111.7.20 / FNH 1.0.0.636 / NHibernate 2.1.2.4000 / NUnit 2.5.2.9222 /...

Fluent NHibernate Automapping with RIA services

Hi guys I've encountered a slight problem recently, or rather a lack of understanding of how NHibernate automapping works with RIA data services. Namely, I don't understand how to use Association and Include attributes. For instance, I've created two tables in my database and corresponding classes (that NHibernate correctly fills). The...

How to Specify Columntype in fluent nHibernate?

I have a class CaptionItem public class CaptionItem { public virtual int SystemId { get; set; } public virtual int Version { get; set; } protected internal virtual IDictionary<string, string> CaptionValues {get; private set;} } I am using following code for nHibernate mapping Id(x => x.SystemId); ...

Exception when retrieving record using Nhibernate

I am new to NHibernate and have just started right now. I have very simple table contain Id(Int primary key and auto incremented), Name(varchar(100)), Description(varchar(100)) Here is my XML <class name="DevelopmentStep" table="DevelopmentSteps" lazy="true"> <id name="Id" type="Int32" column="Id"> </id> <property name="Name" column="...

Nhibernate - How can I Map junction table in XML

I have 2 tables having many to many relation and hence there is junction table to resolve this like... Table1, Table2 and Junction table name Table1Table2 having Foreign key of Table1 and Table2 and both are composit key here is what I am doing and getting exception <class name="Table1Table2" table="Table1Table2" lazy="true"> <many-to...