The convention-based Auto Mapping feature of Fluent NHibernate. Not to be confused with AutoMapper, the convention-based object-to-object mapper.
Questions tagged [automapping]
251 questions
0
votes
2 answers
Make IQueryable via NHibernate prefer Join over Exists
If I write the code below:
session.Query.Count( p => p.Children.Any( c => c.Name == "Child" && c.Age == 10 ) );
The generated SQL is:
select cast(count(*) as INT) as col_0_0_ from "Parent" parent0_
where exists (select children1_.Id from…

Maate
- 1,000
- 1
- 6
- 15
0
votes
1 answer
Automapper two level mapping
I have a problem with my AutoMapper configuration, I can map for one level but I don't know if there exists a way to map for two levels
I have:
Class A
{
public int id {get; set;}
public string nom {get; set;}
public B Bprop {get;…

Coder Passion
- 65
- 1
- 11
0
votes
1 answer
Fluent NHibernate AutoMapping Override ignoring column name
Two tables:
CREATE TABLE [dbo].[Error](
[ErrorId] [int] IDENTITY(1,1) NOT NULL,
[ResponseId] [int] NOT NULL,
CONSTRAINT [PK_Error] PRIMARY KEY CLUSTERED
(
[ErrorId] ASC
)
CREATE TABLE [dbo].[Response](
[ResponseId] [int]…

Josh Winkler
- 166
- 12
0
votes
1 answer
Automapping based on condition
I'm trying to use Automapper v3 to map from my Post struct to my Postmodel class. I need to map Term Name to my Categories array but only if the Type equals "Category".
Here's my code
public class NewsModel
{
public NewsModel(int…

heymega
- 9,215
- 8
- 42
- 61
0
votes
1 answer
Can't figure out what the other side of the many-to-many property 'Users' should be
My Domain auto mapping was working but now as I updated my NHibernate stack I'm getting mapping exception when Session Factory is building the Configuration:
"Can't figure out what the other side
of the many-to-many property 'Users'
should…

csizo
- 73
- 6
0
votes
1 answer
fluent nhibernate: INSERT error when saving a new entity with a child entity
I am trying to save a new entity 'Post' with 1 item added to its 'Revisions' List.
A Post can have many PostRevisions, and a PostRevision can only have one Post.
I have tried several ways of mapping the PostRevisions, my PostRevisionMap is as…

David
- 8,340
- 7
- 49
- 71
0
votes
1 answer
Custom Id column in the Fluent NH entity name
I am using S#arp architecture with Fluent Nhibernate and Automapper on a legacy DB.
The id column of one of the tables is different from the Automapping convention and therefore I tried to override it without success. I end up with this…

Quintin Par
- 15,862
- 27
- 93
- 146
0
votes
2 answers
Is it possible to use a Fluent NHibernate convention to map all ICollections as sets?
Is it possible to use a Fluent NHibernate convention to map all ICollections as sets? I have an entity like so:
public class NoahsArk
{
public virtual ICollection Animals { get; set; }
public NoahsArk()
{
Animals = new…

Daniel T.
- 37,212
- 36
- 139
- 206
0
votes
1 answer
What are the disadvantages of keeping the parent as a property of the child in Fluent NHibernate?
I'm using Fluent NHibernate/Automapping and I have a class that has a collection, and each item in that collection has its own collection.
public class A
{
public virtual IList Items { get; set; }
}
public class B
{
public virtual…

Brandon
- 68,708
- 30
- 194
- 223
0
votes
1 answer
What is the Fluent NHibernate Convention for value object list
I'm trying to figure out what the convention would be for a value object list, in this case an IList. Here a code fragment for my domain model:
public class RegionSetting : Entity {
public virtual bool Required { get; set; }
public virtual…

DavGarcia
- 18,540
- 14
- 58
- 96
0
votes
2 answers
Mapping a many-to-many relation with Fluent NHibernate where one of the relations is a component
I have the following class tructure.
public class SearchTarget : IEntity {
public virtual String Name { get; set; }
}
public partial class PoliceAssistance {
public virtual Search SearchWithWarrant { get; set; }
public virtual Search…

Modus Operandi
- 552
- 1
- 6
- 24
0
votes
2 answers
NHibernate: Overriding automapping on a one to many relationship
I've just started to play around with Fluent NHibernate and would like some help / pointers on how I got about mapping this. Here's the domain model I'm working with:
Class User: Your standard user class
Class Preference: A set of key value pairs.…

Tejaswi Yerukalapudi
- 8,987
- 12
- 60
- 101
0
votes
1 answer
Is it possible to use both automapping and schema generation with Fluent NHibernate?
I'm using the following:
Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(connectionString))
.Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf()
.Where(t =>…

Daniel T.
- 37,212
- 36
- 139
- 206
0
votes
1 answer
how to specify a composite key, in which one key is an identifier and another is not, using fluent nhibernate
I'm trying to specify a composite key, in which one key is an identifier and another is not, using fluent nhibernate. Is it possible in fluent? If yes, what I'm doing wrong in below mapping?
public void Override(AutoMapping mapping)
{
…

Varghese
- 3
- 2
0
votes
1 answer
NHibernate missing SqlParameter for overriden property
I'm trying to implement table-per-hierarchy approach, using FluentNHibernate AutoMapping.
I have a base class and three child classes. The third child class overrides a couple of properties of the base class. Instances of first two child classes…

Igor
- 131
- 1
- 9