Questions tagged [automapping]

The convention-based Auto Mapping feature of Fluent NHibernate. Not to be confused with AutoMapper, the convention-based object-to-object mapper.

251 questions
4
votes
1 answer

Automapper mapping nested objects

I have following classes structure public class ClassA { public ClassB objB; } Public class ClassB { public ListOfData objListofData; } public class ListOfData { public Employee objEmp; } public class Employee { public string…
Dmehro
  • 1,269
  • 1
  • 16
  • 29
4
votes
0 answers

Fluent NHibernate and automapping generic types

I'm automapping most of my model, but have a problem with generics. I've got ValueContainer, and I make it abstract so that it doesn't throw an exception during automapping. Next, I have to create classes like StringValueContainer just to…
ulu
  • 5,872
  • 4
  • 42
  • 51
4
votes
1 answer

Help making Fluent NHibernate create an oracle sequence for each table

I am using Fluent NHibernate's (1.0 RTM) automapping feature to create my oracle database schema. My issue is that all the tables are using a single "hibernate-sequence", whereas I would prefer (and my boss would demand) a sequence generator for…
rebelliard
  • 9,592
  • 6
  • 47
  • 80
4
votes
2 answers

nHibernate mapping for entity to multiple different parent entities (eg Addres -> Firm, Addres -> Client)

Can someone help me with the best way to map the following situation in fluent nHibernate? The Address class is used in both Client and Company. How can I store it most efficient in SQL? And what should the mapping look like? I've thought about…
Jan Gils
  • 41
  • 2
4
votes
3 answers

Fluent NHibernate and computed properties

I'm using Fluent NHibernate, and auto-mapping the classes. I have a computed property in a class along the lines of public virtual DateTime? LastActionTimeStamp { get { return Actions.Count == 0 ? null : Actions.OrderByDescending( …
harriyott
  • 10,505
  • 10
  • 64
  • 103
4
votes
4 answers

Fluent NHibernate (with automapping) not saving join table values in many-to-many

I am not exactly an NHibernate expert, so this may be a lack of understanding in that department. I have two simple entities with a many-to-many relationship public class Category { public virtual int Id { get; private set; } public virtual…
Matt Briggs
  • 41,224
  • 16
  • 95
  • 126
4
votes
3 answers

Fluent NHibernate AutoMapping throws "StaleStateException" when try to Commit a List<>

The following code throws a StaleStateException exception when the Order.OrderItems property (an IList) is Commited. The full text of the exception is: An unhandled exception of type 'NHibernate.StaleStateException' occurred in…
Tom Bushell
  • 5,865
  • 4
  • 45
  • 60
4
votes
6 answers

Fluent NHibernate DuplicateMappingException with AutoMapping

Summary: I want to save two classes of the same name and different namespaces with the Fluent NHibernate Automapper Context I'm writing having to import a lot of different objects to database for testing. I'll eventually write mappers to a proper…
Scott Cowan
  • 2,652
  • 7
  • 29
  • 45
4
votes
3 answers

Fluent NHibernate. Auto Mapping and Conventions

Im new to NHibernate, the configuration aspect of it has always seemed overly onerous to me. Yesterday, I came across the Auto Mapping features of Fluent NHibernate and was suitably impressed. To educate myself, I set myself the challenge of…
Paul
4
votes
1 answer

automapping: IgnoreProperty on Component?

I am automapping measurement classes (that implement interface IMeasurement) as components. This works fine, but I have some attributes in the components I would like to ignore. Apparently I cannot use IgnoreProperty on the measurement classes…
Yggdrasil
  • 51
  • 3
3
votes
2 answers

fluent nhibernate discriminator from related table

I've the following 3 table's with example values of Vehicles ( id = 1, type_id = 20 , ... ) Vehicle_Types ( vt_id = 20, class_id = 160, ... ) Vehicle_Classes ( vcls_id = 160, name = "Concrete1" ) I've got public class Concrete1 : Vehicle { } And…
Alex
  • 11,479
  • 6
  • 28
  • 50
3
votes
1 answer

Add (unique)index to properties of Fluent Nhibernate auto mapped classes

We are using Fluent NHibernate with automapping for our objects. Something like: AutoPersistenceModel autoMap = AutoMap .Assemblies(mappingConfig, assembliesToMap.ToArray()) .Conventions.AddFromAssemblyOf(); I want to to…
k.c.
  • 1,755
  • 1
  • 29
  • 53
3
votes
1 answer

How to use AutoMapper for mapping with nesting properties?

I have 2 tables [Customer] [Sale] and related with each others, I try to map Sale to SaleDto and show with customer name. Customer Model public class Customer { public int Id { get; set; } public string Name { get; set; } public…
3
votes
0 answers

Change column for joined class mapping in Fluent NHibernate Automapping

I have an inheritance public abstract class UserEntity : Entity { public virtual int Id { get; protected set; } } public class Employee : UserEntity { public virtual string Email { get; set; } } Entity is a standard for NH class where…
3
votes
2 answers

Multi-column unique constraint FluentNHibernate automap via convention

Does FluentNHibernate's automap support creating a multi-column unique constraint via convention? I can easily create a single column unique constraint: public void Apply(IPropertyInstance instance) { if(instance.Name.ToUpper().Equals("NAME")) …
Michael Shimmins
  • 19,961
  • 7
  • 57
  • 90
1 2
3
16 17