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

nHibernate One to One property null when loaded

I have a One to One relation between a TimeRecord and the Location. This implementation is exactly the same es described in documentation: https://github.com/jagregory/fluent-nhibernate/wiki/Fluent-mapping public class TimeRecordMap :…
0
votes
1 answer

Fluent NHibernate "HasMany" classes in Configuration.ClassMappings

I'm trying to create a procedure to check the database structure, and for most of it I just look at "NHibernate.Cfg.Configuration.ClassMappings", but I can't find in the PersistentClass collection or each class properties the list of tables…
0
votes
1 answer

NHibernate / FluentNHibernate composite id camel case naming convention

Can someone direct me how to define a naming convention for CompositeId() in NHibernate? I tried implementing ICompositeIdentityConvention (not working) : public void Apply(ICompositeIdentityInstance instance) { …
0
votes
1 answer

Fluent Nhibernate HasManyToMany Inheritance

public class Student { public int StudentId { get; set; } public string StudentName { get; set; } public List LiteratureCources { get; set; } public List DrawingCources { get; set; } public List
0
votes
1 answer

NHibernate property value null but member value not null

I have a object that has a property that is a reference to another type and uses a camel case private member variable as a backing. When I run my application the property value is being returned as null but if I debug and inspect the field it is…
0
votes
1 answer

Fluent Nhibernate how to set values for not null columns during cascade save

I have tables with following relationship: public class Physicians { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual List Specialties{ get; set; } public virtual User CreatedBy {…
0
votes
1 answer

reproduce no persister for: exception using nhibernate in c#

My application uses Nhibernate and Fluent Hibernate Mapping. In the Live Production no persister for Exception is coming while saving the entity in the datbase. The Application uses multiple database and ISession is used to set the databases context…
Asghar
  • 1
0
votes
1 answer

How do I map an Oracle timestamp to a DateTime in Fluent NHibernate?

I have a column in Oracle that is a TIMESTAMP(6) WITH TIME ZONE. I am getting an exception when attempting to load records from the table: System.ArgumentOutOfRangeException : Year, Month, and Day parameters describe an un-representable…
Greg Finzer
  • 6,714
  • 21
  • 80
  • 125
0
votes
1 answer

FluentNHibernate - how to update entity with many to many?

I have a complex entity with two collections one to many, I would like to update them how can I do it? Here is my mapping: internal sealed class LeadMap : ClassMap { public LeadMap() { Id(x =>…
hackp0int
  • 4,052
  • 8
  • 59
  • 95
0
votes
0 answers

Fluent Nhibernate References

All of my classes are being mapped with Not.LazyLoad(), if that is part of the issue. So I figured out a fix to my previous problem, but it was ugly and I would still like to know if anyone has a better solution. More detail, I was trying to…
0
votes
1 answer

How do I get table-per-inheritance-hierarchy to work with Fluent NHibernate AutoMapping and integer discriminators?

I've tried searching for information on this all over the place, but no one seems to quite cover this issue. I've reduced it to the following example. This is my database : create table ThingTypes ( Id int, Name varchar(50) not null …
adhocgeek
  • 1,437
  • 1
  • 16
  • 30
0
votes
1 answer

NHibernate any array values are contained in a string does not work?

I'm trying to do this: public static IQueryable WhereLocations( this IQueryable query, string[] locations) { return query.Where(x => locations.Any(t => x.Location.StartsWith(t))); } How ever…
Bjarte
  • 2,167
  • 5
  • 27
  • 37
0
votes
1 answer

Force join inside of mapping of class

Let's say I have 2 classes, User and Message public class User { public virtual Guid Id { get; set; } public virtual string Name { get; set; } } public class UserMap : ClassMap, IMappedEntity { public UserMap() { Id(x…
0
votes
1 answer

persisting a simple tree with Fluent Nhibernate

I have a tree stucture model (used composite pattern). it's class diagram is like this: database diagram: and sample of tree: the problem rise when I want to persist CombatElement tree which its depth is more than one, when I try to persist such…
0
votes
1 answer

How can I map not reference object as foreign key on Nhibernate?

public class Entity { public virtual TId {get;set;} } public class TenantId { public virtual Guid Id {get;set;} } public class Tenant : Entity { public string Name {get;set;} } public class AccountId { public…