I have very simple object structure for Person's and their marriage relations. I have exactly same structure in the db as well.
public class Person
{
public virtual string Id { get; set; }
public virtual ISet MarriageRelations { get; set; }
}
public class MarriageRelation
{
internal virtual int Id { get; set; }
public vi...
Suppose I have this class:
public class GroceryListItem()
{
public GroceryList { get; private set; }
public GroceryListItem(GroceryList groceryList)
{
GroceryList = groceryList;
}
}
What is the NHibernate mapping file access strategy for this scenario? (i.e. <one-to-many name="GroceryList" column="XXX" access="?????" />)
...
I have 3 tables:
Media
Selectionlist
and then an intermediate table for saving media that are in a certain selectionlist called selectionlist_mediamembers.
I have mapped them as following:
Media.xml
<bag name="SelectionlistMediamembers" lazy="true" cascade="all-delete-orphan" inverse="true" where="deleted = 0" >
<key column="m...
Hi, I have a Customer table and an AddressTable. My table looks like this :
Table Customer
{
ID,
Name
}
Table Address
{
ID,
CustomerID,
AddressType,
Address
}
(AddressType is 1 for HomeAddress and 2 for WorkAddress)
In my Customer class I have 2 properties for Address type
class Customer
{
Address HomeAdress;
Address WorkAddress;...
Considering this example as a base example. I created the application but when I execute this application getting the following error.
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Ex...
I have 2 entities- Classroom and Section, that I need help with NHibernate mapping. A Classroom has a collection of Sections. And the Section has a reference back to its owner Classroom.
On the code side:
public class Classroom
{
public int Id { get; set; }
public ISet<Section> Sections { get; set; }
}
public class ...
Considering this example as a base example. I created the application but when I execute this application getting the following error.
The ProxyFactoryFactory was not configured.Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers. Example: ...
Hello,
I'm trying to map a relatively simple parent-children (Invoice-InvoiceEntry) scenario in NHibernate. Here are some parts of my mapping files:
from Invoice.hbm.xml
<set name="InvoiceEntries" table="InvoiceEntries" inverse="true" cascade="all-delete-orphan" lazy="false">
<key column="InvoiceID" />
<one-to-many class="Jobflow....
Hi,
Let's say I have a simple parent->child class structure as shown below
Public Class Parent
Public ParentID As Integer
Public Children As IList(Of Child)
End Class
Public Class Child
Public ChildID As Integer
Public Parent As Parent
End Class
These are mapped to two tables using Fluent NHibernate. No problem.
I now have ...
I have an enum called Permissions. A user can be assigned permissions, or permissions can be asigned to a role and the user can be given a role.
User and Role both have a property like this:
public virtual IList<Permission> Permissions { get; set; }
I want to use an enum for Permissions so in my code I can do things like
public sta...
So everything is working well with the basic discriminator mapping. I can interact directly with entities A and B without any problems.
public class BaseType {}
public class EntityA : BaseType {}
public class EntityB : BaseType {}
This maps without drama in the BaseType mapping as
DiscriminateSubClassesOnColumn<string>("Type")
...
Hi,
I have the following DB Table
CREATE TABLE ProductPrice
ProductID
Qty1
Price1
Qty2
Price2
Qty3
Price3
My domain classes look like this
Class ProductPrice
ProductID As Integer
PriceBands As IList(of PriceBand)
End Class
Class PriceBand
Qty As Integer
Price As Decimal
End Class
I know we can use the "compo...
There are two tables Person and Address. I have a mapping table PersonAddressMap which contains an additional column IsCurrent other than the two foreign keys (no explicit primary key column). I have created three mapping classes one each for Person, Address and PersonAddressMap. I need to access all the Addresses of a Person and also ac...
Hello,
I seem to be having trouble modeling inherited classes using JoinedSubClassPart in Fluent NHibernate (release 524). I have seen other posts indicating that the approach I am using (see below) should work, yet at runtime I get the following exception (thrown by ImappingPart.PositionOnDocument method of JoinedSubClassPart):
XunitE...
Trying to wrap my head around nHibernate, curiuos how this scenerio would be handled:
Post (postID, title, content, dateCreated)
Category (categoryID, name, postCount)
post_to_categories (postID, categoryID)
If I create a Post, it should insert into Post, insert into post_to_categories and update the postCount in Category.
I am plan...
Hi,
I'm trying to build a document management system and despite all the thigns i've read about entities, value objects, how to choose between how to map them etc... i still can't figure out what the "correct" way to do it is. Quite typically in such a scenerio, each document can beong belong to one or more categories, can be viewed by...
I have tried various approaches to mapping the following structure, but I finally admit that after a day of not getting very far, I need some help.
So the question is, how would you guys go about mapping something like this. The schema is not fixed at this point.
public abstract class BaseObject
{
public virtual int Id { get; set; ...
Currently I have database with the following associations:
One Client to Many Intakes
One Intake to Many CaseManagements
One CaseManagement to Many Interventions
Client, Intake, CaseManagement are single classes per table
Intervention is a class-hierarchy-per-table.
Currently, if I do something like this:
var client = new Client()...
Hi there,
I have xml files containing data that I wish to insert into my database using Nhibernate. I can write some Linq that will process my data and map it to my nhibernate objects but I was wondering if there was some way of doing this without the need to write the translator from XML to Nhibernate myself.
Am not sure if something e...
I am having a problem with fluent nhiberbate mapping two tables to one class.
I have the following database schema:
TABLE dbo.LocationName
(
LocationId INT PRIMARY KEY,
LanguageId INT PRIMARY KEY,
Name VARCHAR(200)
)
TABLE dbo.Language
(
LanguageId INT PRIMARY KEY,
Locale CHAR(5)
)
And want to build the following class def...