fluent-nhibernate

How do I use Sql Server 2005 Symmetric or asymmetric keys through fluent nhibernate?

Here is my issue. I have an account object as follows: public class Account { public virtual int AccountId { get; set; } [Required(ErrorMessage = "Email address is required.")] public virtual string EmailAddress { get; set; } [Required(ErrorMessage = "A password is required.")] public virtu...

Can you add onto an Action dynamically?

I want to be able to add to my Mappings Action dynamically, so that when I run a particular integration test I can export the mappings to an xml file. So I have the following setup for my Mappings: private static Action<MappingConfiguration> _mappings; public static Action<MappingConfiguration> Mappings { get { return _mappings ...

(Fluent) NHibernate: force foreign key to null on delete

I have a standard parent - child (1:many) relationalship, configured using Fluent NHibernate: On the parent side: HasMany(x => x.Items).Inverse().Cascade.All(); and on the child side: Map(x => x.ItemCategory).Nullable().Index("idx_item_category").Not.LazyLoad() (Edit in response to epitka's comment:) The record is deleted by call...

Expected System.String, got System.Guid

I am hoping there is a very simple explanation why I am getting this error. I am using S#arpArcitecture 1.6. on a 64bit Windows 7 install. Line 3 of the following code gives the error: {"Provided id of the wrong type. Expected: System.String, got System.Guid"} System.Exception {NHibernate.TypeMismatchException} 1 public Category G...

Is Fluent NHibernate ready for production code now?

The subject of this question speaks for itself. I am wondering if Fluent NHibernate is ready for production code. I am especially wondering in light of some seemingly simple problems that I am having with it that I haven't yet found fully satisfactory solutions for (and the community doesn't have a solution for?) Why is Fluent NHibernat...

NHibernate combining two database tables into one object

Hello all, I am using FluentNhibernate and i have a question about is. Is it possible two combine data from to different database tables into on entity? I have to work with an access database and an mssql datatbase and to work with both i think it is easier to combine. For example Db table 1 - name - address - email Db table 2 - ...

How to save ValueObject in S#arpArchitecture

Hi, I am using S#arp Architecture and have a class that maps to a table in the database. This table and class does not have any PrimaryKey or Domainsignature, so I thought it would be a good fit for ValueObject. I know I can map this as a component by using the mapping overrides in Fluent NHibernate to accomplish this. However I am stru...

How to map property to first of many in Fluent NHibernate?

Given a parent child relationship between User and FailedLogin where a user has many failed logins. I'd like to map this into class User { public virtual FailedLogin LastFailedLogin { get; set; } } class FailedLogin { public virtual User User { get; set; } public virtual DateTime AttemptOn { get; set; } } So that the Las...

Foreign key is null when NH save the childs collection

I try to map NHibernate to an existing database structure. Unfortunately I can not change the existing structure. First I'll give some background and then explain the problem itself Relational analysis is quite simple: Log is the main Entity. he has one-to-one relationship with Form. the foreign key is FormID. Buyer & Seller are col...

Fluent NHibernate Adding and Updating problem : References

Im fairly n00bish when it comes to fluent nhibernate but i have an unexpected error in one of my repositories. I have a datatype CostCode public class CostCode { public virtual int Id { get; set; } public virtual String CostCodeCode { get; set; } public virtual Company Company { get; set; } public virtual DateTime Creat...

[FluentNHibernate] Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'

Hi! I'm using Microsoft Visual Studio 2010. I start to work with FluentNHibernate 1.1. After configuration.BuildSessionFactory() execute, i have exception. Message "Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. Castle.DynamicProxy...

(Fluent)NHibernate and PostgreSQL 9

We currently have a FNH - MySQL 5.1 DAL in our .Net LOB app. Some recent tests we did showed that PostgreSQL does perform faster than MySQL, and we believe the table partitioning feature in PostgreSQL will be very important with a table in our database we foresee to grow into 100 million rows and more (in production). Has anyone upgrad...

HasMany cause KeyNotFoundException on Delete

hi i'm new to nhibernate and i read a lot of threads with similar problems, but i dont get it working. i use oracle, nhibernate3 alpha and fluent nhibernate for mapping. i have a parent child relation. the child table has a composite id. Select, insert, update records works. Delete a parent without child records works. But deleting a par...

Nhibernate ManyToMany with a dynamic where clause

I'm having some issues mapping a complex many to many relationship in fluentnhibernate. I have a legacy db which looks something like this: Foos: | Id | Foo | FooBars: | FooId | BarId | Bars: | Id | Bar | CultureId | which I am trying to map to the following object model: class Foo { property virtual int Id { get; set; } prop...

NHibernate code genaration tool for asp.net (c#)

Hello Guys, Any idea of any tool I can use to generate asp.net (c#) scripts for NHibernate. I was told some come with unitTest Scripts as well. I just need a good template to start a project using NHibernate with C# web application. This a new territory for me Cheers ...

How to map composite-id with fluent nhibernate using an interface?

Hello, i'm trying to switch out .hbm mappings to fluent mappings an have a problem with the mapping of composite-ids and the usage of Interfaces the Class looks at follows: public class ClassWithCompositeId { public virtual IKeyOne KeyOne { get; set; } public virtual IKeyTwo KeyTwo { get; set; } } our hbm mapping looks like this...

How to specify an auto-incrementing (int) identity column using Fluent-NHibernate and MySQL

The title basically says it all... I'm trying to specify an auto-incrementing (int) identity column using Fluent-NHibernate and MySQL. I've tried the following variations... Id(x => x.ID).GeneratedBy.Native(); Id(x => x.ID).GeneratedBy.Identity(); Id(x => x.ID).GeneratedBy.Increment(); ...and tried setting default values on eac...

How do I create an entity through a RESTful PUT with NHibernate?

According to REST philosophy, a PUT operation should create an entity if it doesn't exist, or update it if it does. So for example, if a client does this operation: PUT http://server/user/5?firstname=John&amp;lastname=Doe I should expect that a user with an ID of 5 either be created or updated. The update case is easy with NHibernate...

Adding audit columns to a Fluent NHibernate many-to-many junction table

I'm using Fluent NHibernate to generate a database schema from .Net entity classes. I have two classes User and Permission with a many to many relationship, and Fluent NHibernate is correctly generating a junction table UsersToPermissions in the database. As expected the junction table is storing the primary keys UserId and PermissionId...

Fluent NHibernate unit tests

Say I've written a custom membership provider which extends System.Web.Security.MempershipProvider. This sits in its own project. overriding the ValidateUser method looks like this: IList<User> Users; using (ISession sess = NHibernateHelper.GetCurrentSession()) { Users = sess.CreateQuery("select u from User ...