fluent

How to override S#arp architecture automapping with HBM files?

I'm facing problems with composite keys in S#arp architecture. Anyone have an example of how to do that or how to use mapping files with automapping? ...

Fluent nHibernate returns null from nvarchar field map & sets to null

Hi, Got a weird nHibernate problem. I have a table called AssetRule which is being mapped with the following code: Public Class AssetRuleMap Inherits FluentNHibernate.Mapping.ClassMap(Of AssetRule) Public Sub New() Id(Function(x) x.Id) Map(Function(x) x.PageType).CustomType(Of PageType)() Map(Function(x) x.Path) Map(Fu...

Fuent NHIbernate two mappings on the same table, no discriminator

Hi all, I have a table that references many items. In the general view, I don't want to load all these references, for obvious performance reasons, but in the global view, I would like to load the same table, with all the references. I tried making two classes mapped on the same table, but it loads the two classes when loading the table...

Fluent NHibernate XML Field

Is there a way to map an XML field using Fluent Nhibernate. If you have an XML field in MSSQL database, how would you Map using Fluent NHibnernate? Example Table("Address"); LazyLoad(); Id(x => x.AddressId).GeneratedBy.HiLo("1000"); Map(x => x.AddressLine1).Length(100).Not.Nullable(); Map(x =>...

fluent nhibernate mapping for combination of table per subclass and single table with discriminator

I am new to fluent nhibernate. I have the following combination of table per subclass and single table with discriminator per subclass structure. Will appreciate any help in mapping this with fluent - specially with automapping: enum type {a, b, c, d} Class pool { int id; IList<Class1> aVals; IList<Class1> bVals; IList<Class2> cVals;...

Fluent NHibernate: Mixing Automapping and manual mapping

If using Fluent NHibernate, is it possible to automap most classes, but specify that a couple of particular classes should be mapped using the regular fluent API rather than being automapped? And if so, can anyone point me to some sample code that shows how to do it? Thanks! ...

fluent nhibernate mapping

I am trying to create a map to get results as like from below query. I am having hard time to get set Product mapping to set References to Product_Line on 3 columns as in where condition. How can I achieve this using fluent? Product table: cId, ProjID, Line, etc., columns Product_Line table: cId, ProjID, Line, etc., columns select f.* ...

How to test if a fluent service method is called

I have a security rule that a newly registered user has full permissions over their own user entity. I'm using Rhino.Security and the code works fine, but I want to create a unit test to make sure the appropriate call is made to setup the permission. Here is a simplified verison of the code: public User Register(UserRegisterTask userR...

NHibernate / Fluent NHibernate Mapping

Is it possible to map the following situation? A product class (currently a table) An account class (currently a table) An accountproduct class (currently a join table but with additional information related to a specific product and account) What I'd ideally like is accountproduct to extend product and to be available from account a...

Fluent NHibernate List<string> Length

I have a List that I am trying to get into the DB and am coming up with the following assert: {"ORA-12899: value too large for column \"GDATA\".\"CNVTOOLBOX\".\"TOOL\" (actual: 387, maximum: 255)\n"} I am overriding the automapping with the following: public class CnvRootMap : IAutoMappingOverride<CnvRoot> { public void Override(...

Is there a reference for EF4 Fluent API syntax?

I keep searching the web for examples of the new fluent API syntax in Microsoft's Entity Framework technology previews ... I come up with bits and pieces here and there. Is there any reliable place to go to find ALL the possibilities? And maybe something that explains them a bit ("HasRequired", "WithMany", etc.)? FYI, I am specifically...

Fluent Nhibernate ClassMaps and Column Order

Our entities have a group of common properties. In order to reduce repetitive mapping, I created a base ClassMap that maps the identities and common properties. For each entity's ClassMap I just subclass the base and it works great. For a new project we are also letting NH generate the DB schema for us. The issue is, the order of the col...

Castle Fluent Registration: can't override a type registered by "AllTypes" with "Component"

Inside a DLL, we've defined two classes ("Class1" and "Class2") which inherit from an interface ("IInterface") and a base class ("BaseClass"). We're using the Castle Windsor's Fluent Registration API ( http://using.castleproject.org/display/IoC/Fluent+Registration+API ) to automatically register all the classes inheriting from "BaseClas...

Fluent nhibernate : HasManyToMany mapping exception

Hello everybody. I'm having issue when I use Fluent nHibernate for mapping entities with my SQL database. To understand the problem, here is an example. This example modelizes via SQL tables a mail box, that allows users to put their mail in one or many folder (like the label system in gmail). // contains every users USER ( Id (b...

Fluent Nhibernate - How to persist collection of new entities with single database call

I have a process where I create multiple new entities. I've tried adding them to a collection (doing a .Persist() on them), and then when my collection is ready, trying to commit the transaction. I've checked to make sure that no database calls are being executed until I call Transaction.Commit(), but once I call commit, I see calls be...

Is there any Fluent NHibernate book?

Taking into consideration that Fluent NHibernate has been available for some time I thought that there would be a book available already so i search in amazon and in google but there is no books for fluent nhiberanet. Am i right or book already exist? ...

Issue with mvcContrib fluent route testing in asp.net mvc

I have an issue with testing routes using the MVCContrib Fluent route testing. The test fails yet the application recognises the routes. Let me explain.... I have the following routes in my register (shown in order) routes.MapRoute( "PurchaseUnitsPaged", "PurchaseUnits/Page{page}", new {...

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...

Fluent NHibernate Hierarchical Data Question (One Table Per Hierarchy)

I am having some trouble depicting a DataBase Setup in NH. I have the following Classes: public class BaseData { public virtual long Id { get; set; } } public class ExtendedData : BaseData { public virtual string Name { get; set; } } The backing tables look like the following: BaseTable -------...

Mapping properties from a foreign table twice in Fluent NHibernate

I have 2 tables like this: (Please note the non-standard db schema naming) table T_Pen TP_ID TP_PrimaryColorID TP_SecondaryColorID ... table E_Color EC_ID EC_ColorName ... And I want to create a mapping of the 2 tables to a domain object Pen using Fluent NHibernate. class Pen { PenID; PrimaryColorName; Seco...