Can someone help me with the best way to map the following situation in fluent nHibernate? The Address class is used in both Client and Company. How can I store it most efficient in SQL? And what should the mapping look like? I've thought about multiple options, but I'm not experienced enough with nHibernate for these situations:
use 1...
I'm trying to make Fluent NHibernate's automapping ignore a Dictionary property on one of my classes, but Fluent is ignoring me instead. Ignoring other types of properties seems to work fine, but even after following the documentation and adding an override for the Dictionary, I still get the following exception when BuildSessionFactory ...
I am retrofitting a very large application to use NHibernate as it's data access strategy. Everything is going well with AutoMapping. Luckily when the domain layer was built, we used a code generator. The main issue that I am running into now is that every collection is hidden behind a custom class that derives from List<>. For example
...
Hi guys,
I am having problems with Mapping.
I have two tables in my database as follows: Employee and EmployeeManagers
Employee
EmployeeId int
Name nvarchar
EmployeeManagers
EmployeeIdFk int
ManagerIdFk int
So the employee can have 0 or more Managers. A manager itself is also an Employee.
I have the following class to represent t...
How do I map a Version property using conventions (e.g. IClassConvention, AutomapperConfiguration)?
public abstract class Entity
{
...
public virtual int? Version { get; protected set; }
...
}
<class ...>
<version name="Version" column="version" generated="never" type="Int32" unsaved-value="0" />
</class>
...
I'm using Sharp Architecture and have a number of situations where Value Objects are used in an Entity. Here is an obvious simple example:
public class Person : Entity
{
protected Person(){}
public Person(string personName)
{
this.PersonName = personName;
}
public virtual string PersonName { get; protected ...
Hi guys,
I am facing an unusual behaviour with the Repository and Transactions
and its making me mad.
I have two simple POCO classes Action and Version as follows. There is
a one to many relationship from Action->Version.
public class Action : Entity
{
public virtual string Name
{
get;
set;
}
public vi...
If I have a parent class:
public class Parent
{
public Parent()
{
Children = new List<Child>();
}
IList<Child> Children {get; private set;}
}
and a child class like so:
public class Child
{
public SomeThirdClass Friend {get; set;}
}
Whenever I let the Fluent NHibernate's automapper hit these guys, it m...
Hi guys,
I have a requirement to load a complex object called Node...well its not that complex...it looks like follows:-
A Node has a reference to EntityType which has a one to many with Property which in turn has a one to many with PorpertyListValue
public class Node
{
public virtual int Id
{
get;
set;
}
...
I've been trying to use AutoMapper to save some time going from my DTOs to my domain objects, but I'm having trouble configuring the map so that it works, and I'm beginning to wonder if AutoMapper might be the wrong tool for the job.
Consider this example of domain objects (one entity and one value):
public class Person
{
public st...
Hi,
I'm trying to map the following tables/entities in FNH and seem to be getting nowhere fast!
**Tables**
Contacts
ID (PK - int - generated)
...
PhoneTypes
ID (PK - varchar - assigned) (e.g. MOBILE, FAX)
ContactPhones
ContactRefId (PK - FK to Contacts)
PhoneTypeRefId (PK - FK to PhoneTypes)
...
(I should...
Hello!
I wonder about something. I'm sitting here with a solution there I have 1 superclass that has 2 subclasses and I'm currently mapping this using JoinedSubClass, but I get that this method is obsolete, and says that I should ClassMap and SubClassMap, but if I do this the AutoMapping does not work, and I don't want that. Is there an...
I'm facing problems with composite keys in S#arp architecture. Anyone have an example of how to do that or how to use mapping files with automapping?
...
Title: multiple class with same variable name list has issues in table definition (all indices not null)
lets say i have two class implementing from one interface
public interface IInterface1
{
IList<string> myList {get; set;}
}
public class class1 : IInterface1
{
IList <string> myList {get; set;}
public class1()
{
...
Today I upgraded my project to FluentNHibernate 1.1. Ever since, when running my project I get the following exception:
Could not find a setter for property 'FullName' in class 'MyNamespace.Employee'
The code for the FullName property is as follows:
public virtual string FullName
{
get
{
return FirstName + " " + La...
how to map a class property variable of interface using automapping..is there a convention of some sort that i shoud add or override
public interface Iface1
{
int id {get;set;}
string Name {get; set;}
}
public class class1
{
public virtual Iface1 myIface
}
...
hi every one,
i have an abstract class
public abstract class Document
{
public int DocumentID {get; set;}
}
and derived class
public class DoctorDocument : Document{
public string DoctorName {get;set;}
}
and I'm using Fluent Auto Mapping,
i need not to make a table for Document, but i need each derived class to get the Document...
I have the following class which I am mapping using Fluent NHibernate's AutoMapper. I do not want the list items publically modifiable so have a public IEnumerable backed by an IList which can be populated internally or by NHibernate.
I want NHibernate to map teamMembers to a column named TeamMembers. I also want FNH to ignore the TeamM...
If using Fluent NHibernate, is it possible to automap most classes, but specify that a couple of particular classes should be mapped using the regular fluent API rather than being automapped? And if so, can anyone point me to some sample code that shows how to do it?
Thanks!
...
How to map a class that has another class nested inside it. I am using automapping. It gives exception 'NHibernate.MappingException: Association references unmapped class: class1+class2'
suppose you have
public class baseclass
{
}
public class class1 : baseclass
{
public class class2 : baseclass
{
}
}
...