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
2
votes
1 answer

Fluent nhibernate automap subclasses from different assemblies

What I need to do is automap subclasses of my abstract page class. I need to find them in a list of assemblies that I get a runtime (at the initialization stage). I don't have any reference to the assemblies from the assembly of my mappings. My…
Mattias Jakobsson
  • 8,207
  • 2
  • 34
  • 41
2
votes
3 answers

How do I map a dictionary using Fluent NHibernate automapping?

I have an entity like so: public class Land { public virtual IDictionary Damages { get; set; } // and other properties } Every time I try to use automapping with the following code: var sessionFactory = Fluently.Configure() …
Daniel T.
  • 37,212
  • 36
  • 139
  • 206
2
votes
1 answer

S#arp Architecture many-to-many mapping overrides not working

I have tried pretty much everything to get M:M mappings working in S#arp Architecture. Unfortunately the Northwind example project does not have a M:M override. All worked fine in my project before converting to S#arp and its choice of Fluent…
2
votes
4 answers

Simple Convention Automapper for two-way Mapping (Entities to/from ViewModels)

UPDATE: this stuff has evolved into a nice project, see it at http://valueinjecter.codeplex.com check this out, I just wrote a simple automapper, it takes the value from the property with the same name and type of one object and puts it into…
Omu
  • 69,856
  • 92
  • 277
  • 407
2
votes
1 answer

Nhibernate updating version column on foreign key entity

I am using c# with Fluent NHibernate and auto mapping. Here is some code (truncated for clarity), then I'll explain the problem. public class Company { public virtual string Description { get; set; } } public class Stock { public virtual…
Steve
  • 1,266
  • 16
  • 37
2
votes
0 answers

IIdConvention "overrides" IAutoMapping

I'm using a specific convention for my Id tables and I'd like to override the way the ID of a specific entity is mapped. In this scenario, most of the entities should a key on the form Class+ID (ex.: EmployeeId, DepartmentId, etc), but I'd like to…
Luis Abreu
  • 4,008
  • 9
  • 34
  • 63
2
votes
1 answer

In Fluent NHibernate how do you combine automapped types with non-automapped types?

Right now, I'm switching my project over from the classic fluent nhibernate style of manually defining a ClassMap for each domain entity, to having the auto-mapper auto-generate the mappings for me. But I'd like to keep using the classes I've…
Mark Rogers
  • 96,497
  • 18
  • 85
  • 138
2
votes
1 answer

Fluent NHibernate automapping class conventions aren't being applied to entire class hierarchy

I'm trying to automap a simple inheritance hierarchy with Fluent Nhibernate, and I need to have a slightly different name for each table than its class (underscores instead of Pascal case). This seems like an obvious place to use conventions. I…
1
vote
1 answer

Not getting NHibernate Cascade Delete Orphan working with Automapping

Having tried several solutions to get NHibernate to delete orphan records. Given the following structure: public class Parent { public virtual ICollection Domains {get;set;} } public class Domain{ public virtual Parent Parent…
1
vote
1 answer

Property which should be a readonly db-field (Fluent NHibernate Automapping)

Im using the Fluent NHibernate together with the automapping functionality. Now im lookin' for something like a configuration, setting, custom attribute - whatever - to declare an entity property as "ReadOnlyFromDb" In the MsSql database im using a…
Daniel W.
  • 449
  • 10
  • 29
1
vote
1 answer

Many to many relationship using Fluent Nhibernate Automapping

We are facing problem applying many-to-many relationship using fluent nhibernate automapping. The simplified form of domain model are as follows: public class Group { private readonly IList _recipients = new List(); …
Niraj
  • 376
  • 4
  • 14
1
vote
1 answer

Why is a custom resolver needed here (AutoMapper)?

Given the following entity model: public class Location { public int Id { get; set; } public Coordinates Center { get; set; } } public class Coordinates { public double? Latitude { get; set; } public double? Longitude { get; set;…
danludwig
  • 46,965
  • 25
  • 159
  • 237
1
vote
1 answer

Automapper AssertConfigurationIsValid stricter control

I just discovered I get no errors if there is no mapping to a property if the source has a property with the same name. We are trying to make it as strict as possible and get errors when there are unmapped properties. It seems like…
Ufuk Hacıoğulları
  • 37,978
  • 12
  • 114
  • 156
1
vote
1 answer

Defining unique column in Fluent NHibernate Automap Override

I'm trying to specify a unique column for an entity, using the Fluent NHibernate Automapper Override. For my test class of CodeType, I'd like to make the Type property unique. The goal would be for a "new CodeType()" being created with the same type…
user1003221
  • 453
  • 1
  • 5
  • 17
1
vote
2 answers

Setting up Fluent NHibernate one-to-many with cascading deletes using the automapper

Extreme newbie question. I have my database (SQL Server) set up to cascade deletes for my relationships so if you delete a parent entity all the children are deleted as well (ON DELETE CASCADE). I want this to be reflected in my automapped Fluent…
roufamatic
  • 18,187
  • 7
  • 57
  • 86