fluent-nhibernate

nHibernate persist IList<DayOfWeek>

Is it possible to persist an IList<DayOfWeek> using nHibernate? public class Vendor { public virtual IList<DayOfWeek> OrderDays { get; private set; } } If not, what are some common solutions; creating a class for OrderDays?, using an IList<string>? ...

Fluent Nhibernate ManyToMany collection - not saving associations

I can't get my head around why this isn't working.. I have a relatively clean entity model consisting of POCOs created with DDD in mind (while probably not following most rules even loosely). I am using Fluent NHibernate to do the mapping. I am also using SchemaExport to create the database schema, with minimum input from me on how to ...

Many to Many Collection in both Entities Fluent NHibernate

I'm trying to map a manyToMany relationship in Fluent NHibernate and running into a problem that's most likely just me being new at the tool. I have 2 Entities, User and Project. A User can be on many projects and a project can have many users. In my map for User I have HasManyToMany(x => x.Projects).Inverse(); When i put the...

Fluent-NHibernate - Component property attributes ignored by Convention

I have a component with a number of properties that have various attributes Normally when these attributes are added to a plain old domain object they are picked up by my custom AttributeConventions. For the Component properties they are not. Is there some extra wiring needed for these? e.g. public class Component { [Length(Max=...

Fluent Nhibernate Mapping Problem

I'm fairly new to nhibernate and fluent nhibernate, I have an issue with associating a collection to a query. In the database I have a well and have 4 associated AFEs. The problem I'm having is that the collection of AFEs is not populating correctly. No matter what I do, I get 4 AFEs in the collection but they are all the same object....

Tool to generate Fluent NHibernate mappings

I am trying to integrate NHibernate into an existing application with several hundred tables. Due to the fact that there apparently wasn't a strict adherence to conventions, I am unable to use Automap. As a result, I'm going to use Fluent to manually map over all of the associations. Rather than doing it by hand, I'm hoping that there i...

How to load only certain columns using fluentnhibernate?

I want to know how can i fill only certain columns while filling the entity object? i am interested in certain properties of the entity and not all. but when i use session to fetch the entity it sends query like "select * from Customer" for example. but i want to do "Select customerName from Customer". I think it has some thing to do...

Nhibernat mapping aspnet_Users table

My User table I want to map to aspnet_Users: <class name="User" table="`User`"> <id name="ID" column="ID" type="Int32" unsaved-value="0"> <generator class="native" /> </id> <property name="UserId" column="UserId" type="Guid" not-null="true" /> <property name="FullName" column="FullName" type="String" not-null="t...

Fluent NHibernate caching with automapping

I'm trying to understand how to configure Fluent NHibernate to enable 2nd-level caching for queries, entities, etc... And at the same time use automapping. There is very little information online on how to do that. Sure it can be done when mapping the classes one by one... But how about automapping? Here is my configuration code so far:...

How to restrict access to a class's data based on state?

In an ETL application I am working on, we have three basic processes: Validate and parse an XML file of customer information from a third party Match values received in the file to values in our system Load customer data in our system The issue here is that we may need to display the customer information from any or all of the above ...

How to map my class to get the db's records with a custom method?

I'm developing a website with ASP.NET MVC, NHibernate and Fluent NHibernate and want to know how can I customize my Map to get records using a custom Method. My entities: public class ImageGallery { public virtual int Id { get; set; } public virtual string Titulo { get; set; } public virtual IList<Image> Images { get; set; ...

How do you map a composite id to a composite user type with Fluent NHibernate?

i'm working w/ a legacy database is set-up stupidly with an index composed of a char id column and two char columns which make up a date and time, respectively. I have created a ICompositeUserTypefor the date and time columns to map to a single .NET DateTime property on my entity, which works by itself when not part of the id. i need t...

FluentNHibernate Overrides: UseOverridesFromAssemblyOf non-generic version

Hi, I have a repository class that inherits from a generic implementation: public namespace RepositoryImplementation { public class PersonRepository : Web.Generics.GenericNHibernateRepository<Person> } The generic repository implementation uses Fluent NHibernate conventions. They're working fine. One of those conventions is that ...

Named query not known error trying to call a stored proc using Fluent NHibernate

I'm working on setting up NHibernate for a project and I have a few queries that, due to their complexity, we will be leaving as stored procedures. I'd like to be able to use NHibernate to call the sprocs, but have run into an error I can't figure out. Since I'm using Fluent NHibernate I'm using mixed mode mapping as recommended here. H...

Fluent NHibernate Map Enum as Lookup Table

I have the following (simplified) public enum Level { Bronze, Silver, Gold } public class Member { public virtual Level MembershipLevel { get; set; } } public class MemberMap : ClassMap<Member> { Map(x => x.MembershipLevel); } This creates a table with a column called MembershipLevel with the value as the Enum st...

FluentNHibernate Unit Of Work / Repository Design Pattern Questions

Hi all, I think I am at a impasse here. I have an application I built from scratch using FluentNHibernate (ORM) / SQLite (file db). I have decided to implement the Unit of Work and Repository Design pattern. I am at a point where I need to think about the end game, which will start as a WPF windows app (using MVVM) and eventually implem...

nHibernate, Automapping and Chained Abstract Classes

I'm having some trouble using nHibernate, automapping and a class structure using multiple chains of abstract classes It's something akin to this public abstract class AbstractClassA {} public abstract class AbstractClassB : AbstractClassA {} public class ClassA : AbstractClassB {} When I attempt to build these mappings, I receive ...

NHibernate and mysql timestamp

I am trying to do versioning with NHibernate and everything works fine, however right after the insert NHibernate tries to pull the generated timestamp by executing the following query: SELECT profileloc_.Updated as Updated14_ FROM profile_locale profileloc_ WHERE profileloc_.id=?p0 and profileloc_.culture=?p1;?p0 = 16, ?p1 = 1033 Wh...

Fluent NHibernate OptimisticLock.None() causes "The string 'none' is not a valid Boolean value."

I'm using the following mapping: public class LoadMap : IAutoMappingOverride<Load> { public void Override(AutoMapping<Load> mapping) { mapping.HasMany(x => x.Bids).OptimisticLock.None(); mapping.Version(x => x.Version); } } But when I try to create the session I get the following exception: [FormatException...

SharpArchitecture: Using FNH's ClassMaps instead of auto mapping

I need to use ClassMaps instead of auto mapping because of legacy database. But I don't see how to tune SharpArch to use them. I tried to remove AutoPersistentModelGenerator and use the following code in the InitializeNHibernateSession method: var config = NHibernateSession.Init(webSessionStorage, ne...