Fluent NHibernate Default Conventions
I'm trying to find a resource that shows what default conventions Fluent NHibernate uses with no custom (user) conventions applied. Thanks! ...
I'm trying to find a resource that shows what default conventions Fluent NHibernate uses with no custom (user) conventions applied. Thanks! ...
Say I already have a Table: Customer First Last Thus I would have an object with properties such as: Customer.First Customer.Last If I wanted to refactor the code so that I rename the properties: Customer.FirstName Customer.LastName Is there a way to indicate to NHibernate to update First to FirstName and so on? I already know ho...
This is possibly an easy one that I can't seem to get past. I've created a "Product" class which has a list of "Accessories". Each "Accessory" is just another product referenced by a lookup table. Table setup: Product ------- ProductID int Name varchar(200) AccessoryProduct ---------------- ID int ParentProductID int ChildProductID i...
How do I escape keyword conflicts when NHibernate generates my column names using FluentNHibernate? NHibernate generated this for me and "Key" is a conflict. create table Setting ( Key NVARCHAR(MAX) not null, Value NVARCHAR(MAX) null, primary key (Key) ) ...
Is this a good guide if I want to implement the repository pattern in my asp.net mvc application? ...
Hi all, I have a Fluent NHibernate mapping like this. public PersonMap() { Table("PERSON"); Map(x => x.FirstName) .Not.Nullable(); Map(x => x.LastName) .Not.Nullable(); HasMany(x => x.Ids) .AsMap<string>("id_type") .Cascade.SaveUpdate(); } So I could do something like this. Person p = new Person(); p.Ids["id1"...
I am trying to use Nhibernate with the Sql 2008 Geography type and am having difficulty. I am using Fluent Nhibernate to configure which I am fairly new to so that may be the problem as well. First, the class I am trying to persist looks something like: public class LocationLog : FluentNHibernate.Data.Entity { public virtual new int...
I have an Order entity in my domain and this name results in erroneous sql statements. I want to quote the table name and don't know how to do it with fluent configuration. Should I add a convention? ...
I'm using the following: Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(connectionString)) .Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf<Incident>() .Where(t => t.Namespace.StartsWith("EDA.DomainModel.POCO")))) .ExposeConfiguration(BuildSchema) .BuildSessionFac...
Hi all, I have a 'User' Entity that contains an 'Address' Value Object. I have this mapping ok using FNH's Component concept. However, the Address VO also contains a Country which is another value object. I had assumed that this should be just nested as another component, but this doesn't seem to work. Can anyone tell me how I shoul...
I have a many to many relationship between entities and there is a table view acting as a lookup table defining the relationship. I'm curious how to map to a view as opposed to a table within a database. ie, Table mapping: public SomeMap() { Id(...)//set Id and other mapped properties HasManyToMany(x => x.Items) .Table("S...
I am using AutoMapping in FNH 1.0 (with Tom Cabanski's modified #arch from 9/2009) to persist a parent-child relationship. The parent and child, Managers and Employees, are both of type User. Managers has a collection of DirectReports of IList because a Manager can have another manager as a direct report. I have a test where I instant...
This is a weird one for me. I have a simple domain with 2 entities Company and Carrier. They have a m:m relation via another table. I set up my Fluent mappings as so public partial class Carrier { public virtual int ID { get; set; } public virtual string Name { get; set; } public virtual IList<Company> Companie...
I have an identity mapping like so: Id(x => x.GuidId).Column("GuidId") .GeneratedBy.GuidComb().UnsavedValue(Guid.Empty); When I retrieve an object from the database, the GuidId property of my object is Guid.Empty, not the actual Guid (the property in the class is of type System.Guid). However, all of the other properties in the o...
Update: It appears that changing my mapping from Cascade.All() to Cascade.AllDeleteOrphan() fixes most of my issues. I still have to explicitly set the Company property on the OperatingState, which seems unnecessary as it's being added to the Company entity, but at least I can work with that during an update. I still need to test that wi...
We use a pesonal design to store modified rows. For the data we need to keep, we use 2 tables; the first with fields that don't change, the second uses soft delete. +----------+ +---------------+ | TableBase| | Table | +==========+ +===============+ | Id | | TableId | | FieldA | | Id | +--------...
I dig a lot of things about the DDD approach (Ubiquitous language, Aggregates, Repositories, etc.) and I think that, contrary to what I read a lot, entities should have behavior rather then being agnostic. All examples I see tend to present entities with virtual automatic properties and an empty constructor (protected or worst, public) a...
I am using automap to map a domain model (simplified version): public class AppUser : Entity { [Required] public virtual string NickName { get; set; } [Required] [DataType(DataType.Password)] public virtual string PassKey { get; set; } [Required] [DataType(DataType.EmailAddress)] public virtual string E...
Let's say I have something similar to this : public class DataType { //For NHibernate private DataType(){} public DataType(string name, Type type, string defaultValue) { Name = name; TypeOfContent = type; DefaultInvariantStringValue = defaultValue; } public string Name { get; set; } ...
Foo has Title. Bar references Foo. I have a collection with Bars. I need a collection with Foo.Title. If i have 10 bars in collection, i'll call db 10 times. bars.Select(x=>x.Foo.Title) At the moment this (using NHibernate Linq and i don't want to drop it) retrieves Bar collection. var q = from b in Session.Linq<Bar>() ...