fluent-nhibernate

Fluent NHibernate PersistenceSpecification CheckList

I am currently working on a college project in which we are using Fluent NHibernate. I am working on figuring how to create testing for our entities and Fluent mappings. I have, however, hit a dead end while trying to figure how to use the CheckList of PersistenceSpecification. The unit test fails with the following error: MvcShop.Cor...

How can I manage creation of views with Fluent NHibernate?

Currently I'm using Fluent NHibernate to automatically create my db schema with automappings. Is there any facility in Fluent NHibernate to specify a view? An external app needs to access my data through database views and I would prefer to create them from within code rather than apply scripts to my database after NHibernate has create...

Specify a Fluent NHibernate automapping to add a unique constraint to all entities

My automapping: return Fluently.Configure() .Database(config) .Mappings(m => m.AutoMappings.Add( AutoMap.AssemblyOf<Company>() .Where( t => t.Namespace == "DAL.DomainModel" && t.IsC...

Visualizing nHibernate model.

Hello, I'm designing a data model using Fluent nHibernate and I'm wondering how to visualize entites, relations and stuff for documentation purposes. This is my first project using Fluent nHibernate. My previous projects were build on Linq2Sql but recently I was a bit annoyed about some L2Q concepts and finally I decided to do a switch ...

the nhibernate cross machine lazy load problem

i got a client a server and a db db mapped to server with fluent nhibernate. so far so good the client talks with the server with wcf. i want to implement lazy loading on client side. is there any solution out there? ...

Error caused by GeneratedBy statement in Mappings when running tests

I am using Fluent NHibernate on a project that has an Oracle 10g database. I am also using SQLite with a schema generated from my mapping for testing. The problem I am having is that, since the primary keys on my tables are generated by Oracle Sequences, to get my Add methods to work correctly I had to add .GeneratedBy.Sequence({sequenc...

Fluent NHibernate Join with Constraint

i have an entity with its properities spread over two tables that i'd like to map to one class using Fluent NHibernate, but with a constraint on the joining table. i've changed the domain of my problem for this question to be the familar 'customer' domain, so my example here may seam a little contrived, but it illustrates my problem. it...

Fluent NHibernate - unit-testing a one-to-many *inverse* mapping

I can't figure out how (or if it's at all possible) to use the Fluent NHibernate PersistenceSpecification<T>.CheckList(...) method to check an inverse one-to-many mapping. Here's what I'm trying to do: Using fluent nhibernate on a vanilla blog/post example, I have defined a one-to-many blog<->posts mapping. One restriction I want is th...

NHibernate Mapping Exception: An association from the table dbo.AccountGroup refers to an unmapped class: System.String

I am getting this error: An association from the table dbo.AccountGroup refers to an unmapped class: System.String This is my entity: public class AccountGroup { public virtual int Id { get; private set; } public virtual string Name { get; set; } public virtual string Parent { get; set; } public virtual string Descript...

Fluent NHibernate Automapper maps Enum to nvarchar(255) and not int?

Why are enums mapped as strings and not as ints when using automapper in Fluent NHibernate? ...

Fluent nHibernate reference mapping question

I need a clue how to map my Invoice class. public class Buyer { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string TaxRegNo { get; set; } // .... more properties.... } public class Invoice { public virtual int Id { get; set; } public virtual int IdBuyer { get; s...

Vb.net project with c# fluent nHibernate mappings project

Having successfully tried out nHibernate, I would now like to try using Fluent for mapping. My main project is in vb.net but I would really like to use c# for the mappings since the lambda expression capability makes it much cleaner. Can you have a separate project/assembly for your mapping files without creating a circular dependency ...

SchemaUpdate does not drop tables or delete columns

I am using SchemaUpdate to make changes to the database based on some configuration. It works fine when new tables or columns are added. However, it does not work when columns are deleted or tables are dropped. The mapping file does reflect these changes, but the SchemaUpdate does not seem to recognize this. I don't want to drop the tabl...

Custom SQL function for NHibernate dialect

I want to be able to call a custom function called "recent_date" as part of my HQL. Like this: [Date] >= recent_date() I created a new dialect, inheriting from MsSql2000Dialect and specified the dialect for my configuration. public class NordicMsSql2000Dialect : MsSql2000Dialect { public NordicMsSql2000Dialect() { Register...

Cannot use Guid Identity in fluentnhibernate

I have the following mapping: public class MyClassMap : ClassMap<MyClass> { public MyClasseMap() { Table("TABLE_NAME"); Id(x => x.Id).Column("TR_ID"); } } When I try to retrieve all the entities using criteria objects I get the following: System.FormatException : Guid should contain 32 digits with 4 dashes...

S#harp architecture mapping many to many and ado.net data services: A single resource was expected for the result, but multiple resources were found.

Hi, I'm developing an application that reads data from a SQL server database (migrated from a legacy DB) with nHibernate and s#arp architecture through ADO.NET Data services. I'm trying to map a many-to-many relationship. I have a Error class: public class Error { public virtual int ERROR_ID { get; set; } public virtual string E...

second level cache not working

i'm trying to work with second level cache this is my fluent mapping class AutoMapping { private ISessionFactory m_SessionFactory; private ISession m_Session; private IDbConnection conn; public ISession configure() { return m_SessionFactory.OpenSession(conn); } public AutoMapping() { Co...

Fluent NHibernate: How to tell it not to map a base class

I have been googling and stackoverflowing for the last two hours and couldn't find an answer for my question: I'm using ASP.NET MVC and NHibernate and all I'm trying to do is to manually map my entities without mapping its base class. I'm using the following convention: public class Car : EntityBase { public virtual User User { get...

working sample of fluent nhibernate with second level cache

i can't find a working simple sample of second level caching with fluent nhibernate. if u found one please give me link. ...

Should I tell NHibernate/FNH to explicitly use a string data type for a param mapped to a string column?

A cohort of mine is building a somewhat long search query based on various input from the user. We've got NHibernate mapped up using Fluent NHibernate, and aside from some noob mistakes, all seems to be going well. One issue we can't resolve in the case of this search is that for a particular parameter, NHibernate is creating sql that ...