Hi everyone, I have a few classes that look like this
public class Token
{
public int Id
{
get;
set;
}
public ITokenInstance Instance
{
get;
set;
}
}
public interface ITokenInstance
{
int Id
{
get;
set;
}
Token Token
{
get;
set...
Hey all,
I am trying to map a legacy database here and I'm running into a problem. In my schema I have a concept of Modules and a concept of Variables. Each Module consists of one or more Variables and each of these Variables has properties specific to that Module. A Varable sits on a Relation.
Based on the classes below what is the b...
My database structure looks something like this:
Person
Id
Name
FieldA
FieldB
Phone
Id
Number
PersonPhone
PhoneId
PersonId
IsDefault
My NHibernate mappings for the Person and Phone objects are straight forward, its the PersonPhone I'm having difficult with. I want to have a collection of PersonPhone objects as a pr...
Hello,
I'm trying to map a Dictionary containing Lists.
I have the following set of tables:
CREATE TABLE Item(id)
CREATE TABLE Filter(id)
CREATE TABLE FilterType(id)
CREATE TABLE ItemFilter(
item REFERENCES Item(id),
filter REFERENCES Filter(id),
filterType REFERENCES FilterType(id)
)
and I want to do this mapping:
class Item...
I am trying to save a record which has a many-to-one property mapping. I attempt to assign a newly created parent object here (or use an existing, but that works fine) but I get an error when it tries to add the ID of the parent object to the child's table. Saying it cannot add NULL to the table, which is true, but I thought nHibernate w...
I'm using NHibernate primarily against an MSSQL database, where I've used MSSQL schemas for the various tables.
In my NH mapping (HBM) files, I've specified the schema for each table in the mapping as follows:
<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
auto-import="true"
...
hi
I have following mapping definitions:
<class name="Role" table="Role" optimistic-lock="version" >
<id name="Id" type="Int32" unsaved-value="0" >
<generator class="native" />
</id>
<property name="RoleName" type="String(40)" not-null="true" />
<bag name="UsersInRole" generic="true" lazy="true" cascade="all"...
Hi
Iam struggling with NHibernate and its lazyload.
I have a structure which I simplified but it show my issue.
Class Shift {
int ShiftID;
DateTime ShiftStart;
Employee Employee;
}
Class Employee {
int EmployeeID;
string Name;
}
Data:
ShiftData
ID SHIFTTIME EmployeeID (int)
1 ...
I have a simple model class (Part), which pulls from it's information from a single table (t_Part).
I would like a subclass of this model called (ProducedPart), that would still utilize NHibernate's caching mechanisms, but would only be instances of (Part) that have a foreign key relationship in a table called "t_PartProduction". I do ...
Actually, the question is more complex than as it is described. I am newbie on nhibernate and I want to map a table with foreign key columns. In most of nhibernate samples the foreign key column assignments are generally implemented by setting the referred entity. I mean, If I have a CategoryId column then I need a Category property and ...
Hi,
if my mapping file, how would I reference a C# enum type?
what about columns from another table?
...
I'm trying to make NHibernate generate my schema/SQL 2008, and using the mapping below it keeps wanting to create an nvarchar(255) column instead of text...any ideas?
<property name="AnnouncementText" column="AnnouncementText" type="StringClob">
<column name="AnnouncementText" sql-type="NTEXT"/>
</property>
Thanks!
...
hi
i have following model:
<class name="Person" table="Person" optimistic-lock="version" >
<id name="Id" type="Int32" unsaved-value="0" >
<generator class="native" />
</id>
<!-- plus some properties here -->
</class>
<class name="Event" table="Event" optimistic-lock="version" >
<id name="Id" type="Int32" u...
I have two tables Deal and Cost. Costs can be of a number of types, eg Planned, Unplanned. Every deal can have one an only one of each type of cost. This is easy enough to map as a many-to-one on deal, reulting in an IList of Costs. But what I want is to create a costs object that has named properties for each cost. So that for a databas...
I am working with Linq-To-NHibernate. I need to use some properties that is not mapped to columns.
For example
Repository<Person>
.Find()
.Select(p => new PersonModel() { Id = p.Id, FullName= p.FullName,Position = p.Position });
The position is not a mapped property, it contains some logic.
I got unmapped property error.
Thank...
I've seen several questions related to properly mapping an enum type using NHibernate.
This article by Jeff Palermo showed me how to do that properly by creating a custom type. I use Schema Export to create my DB during my dev cycles, but this method breaks my export statement. Is there a way to specify the type of the column on export?...
hello i got an application that uses nhibernate as orm, i need to store data that represents time,
whats the best way to do it?
nhibenate dont know to convert time field from db to a timespan, only string.
...
Let's say my domain looks like this:
I have an object, Vehicle, that has an OdometerReading property.
An OdometerReading has the Miles & Date (when it was read).
I need to keep a history of all OdometerReadings for the Vehicle in the database, but don't want the entire odometer history to belong to the Vehicle object. What I wou...
I am new to fluent nhibernate and nhibernate. I want to write a fluent nhibernate autopersistence convention to handle creating the many to many mappings for my entities.
This is what I have right now:
using System;
using FluentNHibernate.Conventions;
using FluentNHibernate.Mapping;
namespace Namespace
{
public class HasManyToMan...
i m new to nhibenate and i really find it painful to write the entire mapping files is there a tool or a vs addin that helps you do the mapping ?
thx for your time :)
...