Questions tagged [fluent-nhibernate-mapping]

Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate

Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents (.hbm.xml files), Fluent NHibernate lets you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Resources

626 questions
0
votes
1 answer

How do you map two or more columns into one object?

Using the fluent-nhibernate mappings, I am trying to meet a requirement to create the following and I think I'm just not using the correct keywords in Google... I have a table and columns: Application appid, appname, appcode, version-major,…
bighead.dev
  • 176
  • 1
  • 8
0
votes
0 answers

Fluent NHibernate Mapping multiple tables has relation and joined to each other

As you see the models have references as one to many. list of project is not mapped here. there are more than one project and the project has more than one role and the role has more than one permission. error is persister system not avialable. can…
0
votes
1 answer

Persistance of 2 one-to-many with NHibernate

I have the following code which uses the repository pattern, backed by a fluent nhibernate automapping to a MySQL DB. The following snippet adds a user, and a person to the model, and then persists to the database. It works, however I have to…
Darbio
  • 11,286
  • 12
  • 60
  • 100
0
votes
1 answer

Map a dictionary with a custom key type using FluentNHibernate

I need to map a Dictionary in one of my ClassMaps, but the key is custom type (essentially, TenthNm is an object that has only an int property). There is a similar question, which lead me to this: HasMany(x =>…
0
votes
1 answer

How to include records from 2 db tables into a single view using NHibernate / Fluent NHibernate?

I'm new to NHibernate / Fluent NHibernate (started with it this weekend) and I'm having difficulties solving the following. I have 2 SQL Server tables: [Client] ID INT NOT NULL IDENTITY(1,1) Name VARCHAR(100) NOT NULL Email …
0
votes
2 answers

Fluent NHibernate - Cannot add items to a HasMany relationship with persisted data

I've got the following classes: public class Client { public virtual Guid ClientID { get; set; } public virtual string ClientName { get; set; } public virtual IList Revenue { get; set; } ... public virtual…
0
votes
1 answer

Specifying when to return null and when to throw in fluent nHibernate based on ID

We're working in a legacy code base that's got a pretty rough data model. Right now, we have a Object Mapping that looks like this: using FluentNHibernate.Mapping; using Validation.Domain; namespace Validation.DomainMaps { public sealed class…
0
votes
2 answers

Can Fluent NHibernate support all mappings from NHibernate

I want to use Fluent NHibernate with NHibernate. But I want to find out whether Fluent NHibernate support all mappings from NHbernate. Or is it better to stick with NHibernate?
0
votes
1 answer

NHibernate mapping error in legacy mapping

I've inherited a large set of NHibernate mappings that live in an existing, functional application. I've branched this application to develop some new features, and while I do so I'm also extending the testing infrastructure to allow for a more…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
0
votes
1 answer

Fluent NHibernate mapping inheritance

Can I have map a abstract class even the object doesn´t exists in my database? Example: public abstract class Type { public string Id{get; set;} } And the subs: public class TypeA : Type { } public class TypeB : Type { } A class who needs the…
0
votes
1 answer

Fluent NHibernate Mapping Doesn't Work For Some Tables

I'm using Fluent Migrator and Fluent NHibernate in the same project but when I launch queries using Database.Session.Query().** some return data and some don't. I can't tell where I'm doing wrong. Database Query That Returns Users: var users…
0
votes
1 answer

Error: fluent NHibernate mapping which references mapping in different assembly

My company has multiple sites which reference the same DB and Core library of code. Then we have a CMS which manages the data. In the Core library I have a Site class which holds a bunch of basic info about each site. This is the fluent mapping I…
0
votes
0 answers

Is there a way to override the DefaultSchema of a fluent nhibernate configuration in the map class?

Background I am working on a .net standard 2.0 library that is using FluentNhibernate 2.1.2. Its fluent nhibernate configuration is set to use a default schema. Fluently.Configure().Database(() => { var db =…
0
votes
1 answer

Problem mapping reference to composite key with Fluent NHibernate

I have a class named... "ClassA" that has an int ID as primary key. I have a class named "ClassB" that has a composite primary key formed by an Id, a ClassAId that is a reference to ClassA, and another int named Version. And I have a class named C…
xecollons
  • 536
  • 6
  • 22
0
votes
1 answer

FluentNHibernate: HasMany mapping to methods (their backing fields)? / Foreign key not saved

Is it possible to map to methods instead of properties? I have a Customer class with a method "GetOrders()" typeof "ReadOnlyCollection" with backing field "_orders" typeof "IList". I tried in…
Alexander Zeitler
  • 11,919
  • 11
  • 81
  • 124