automapping

Fluent NHibernate auto mapping - how to create a many-to-many relationship table?

Hi, just wondered if anyone know if there is a way to crate a Many-to-Many relationship table automatically using some attribute? without creating the table, or mapping a class to become that relation table. If i add the attribute [ManyToMany(3,Class="DeploymentListUsers")] i get an error that this class isn't mapped to the DB. NH...

Is there a Fluent NHibernate Automapping sample project that "just works"?

I just started looking a NHibernate this week, and would love to use the Automapping approach on my current project. I'm working with Fluent NHibernate 1.0.0.594, which I downloaded a few days ago. I found the Examples.FirstProject in the NHibernate source code, which uses the older style entity mapping. This has been tremendously val...

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 NHibernate.dll Additional information: Unexpected row count: 0; expected: 1 I've just started using NHibern...

How do you automap List<float> or float[] with Fluent NHibernate?

Having successfully gotten a sample program working, I'm now starting to do Real Work with Fluent NHibernate - trying to use Automapping on my project's class heirarchy. It's a scientific instrumentation application, and the classes I'm mapping have several properties that are arrays of floats e.g. private float[] _rawY; ...

How can I use Fluent NHibernate Automapping with multiple Lists of the same type in an Entity?

It appears that NHibernate cannot automap more than one IList of a given type in an entity. Consider the following two entities (based on the Examples.FirstProject sample code that is included with the Fluent NHibernate source code). public class Employee { public virtual int Id { get; private set; } public virtual string Fir...

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 another, and you can add exceptions (ifs, switch) for each type you may need so tell me what do...

Fluent NHibernate enforce Not Nullable on Foreign Key Reference

Hello All, Just getting my feet wet with some Fluent NHibernate AutoMap conventions, and ran into something I couldn't figure out. I assume I'm just not looking in the right place... Basically trying to enforce NOT-NULL on the "many" side of the one to many relationship. It seems, using the automapping, it always makes the parent proper...

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 NHibernate's Auto mapping. I like the auto-mapping, it's good, however the overrides do not se...

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 string Name { get; set; } public virtual IList<string> Options { get; set; } } My au...

Generate C# entities from existing DB and Fluent NHibernate auto mapping

I'm working with an existing database that uses some really ugly conventions. I'd like to use NHibernate, and I think I can fix all these ugly DB conventions using Fluent NHibernate's auto mapping conventions. I'd like to avoid writing all the entity classes by hand. (This is where LINQ to SQL and SubSonic are appealing) Is it possib...

Cascade options for many-to-one

I am using Fluent NHibernate Automapping and am pretty new to this framework. I have a 'Tab' object which has a single reference to another object 'Caption'. When using Automapping, this relation is generated in the hbm file as a many-to-one relationship with cascade="all" as I have used the Cascade.All() setting for this. Because of t...

Ignore IDictionary in abstract base class using Fluent Nhibernate Automap

I'm trying to ignore a property of type Dictionary in my abstract base class by doing this .Override<Item>(map => map.IgnoreProperty(x => x.Details)) ... I'm getting this error when doing so ... The type or method has 2 generic parameter(s), but 1 generic argument(s) were provided. A generic argument must be provided for each generic...

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<ClassB> Items { get; set; } } public class B { public virtual IList<ClassC> ChildItems { get; set; } } This is related to this question, which was never...

Fluent NHIbernate automapping of List<string> ?

Fluent NHibernate doesnt like this, throwing an error '{"Association references unmapped class: System.String"}'. Ok fine, I can see why this would cause a problem - but whats the best solution? I dont really want it to store a delimited list of strings in a single field, this would get ugly if my list contains many strings. I also do...

How do I map a dictionary using Fluent NHibernate automapping?

I have an entity like so: public class Land { public virtual IDictionary<string, int> Damages { get; set; } // and other properties } Every time I try to use automapping with the following code: var sessionFactory = Fluently.Configure() .Database(SQLiteConfiguration.Standard.InMemory) .Mappings(m => m.AutoMappings.Add...

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<Animal> Animals { get; set; } public NoahsArk() { Animals = new HashSet<Animal>(); } } With fluent mappings, this property would be mapped as HasMan...

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 error FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete config...

Is a mapping library like AutoMapper available on the .NET Compact Framework 3.5?

Is anyone working on a .NET Compact Framework port of AutoMapper or are there any similar mapping libraries for the .NET Compact Framework? ...

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 page class looks something like this: public abstract class Page : EntityBase { public ...

Fluent nhibernate automapping - how to order columns

With Fluent mapping it was easy, the order of definition is the order of schema creation. With auto mapping it is different. Does anyone know how to set the order of generated columns? Thanks. ...