Hi,
I have a class that one of its members defined like this :
[DataMember]
public virtual IList<T> RelatedXs
{
get
{
return this.m_relatedXs;
}
private set
{
this.m_related = value;
}
}
But when I try to Save it using NHb Session object,
I get this exception :
"Cannot serialize member Rela...
I have a new MVC 2 project using ninject 2 for IOC. I have the following global.asax which sets up both NHibernate and Ninject. The code runs fine, ninject pulls out the controllers from the assembly (it does convert them to lowe case strings when it does this - inside the Ninject source).
All my controller URL's are now case sensitive ...
This is continuation of http://stackoverflow.com/questions/3844327/timeout-exception-when-timeout-set-to-infinite-time (and I also see unanswered http://stackoverflow.com/questions/3752440/sqlconnection-and-transactionscope-timeout question).
I am using CastleProject ActiveRecord over NHibernate, C# 3.5. I have multiple subsequent inser...
I have a WCF Service, hosted inside of IIS, using NHibernate for data access.
In my Global.asax I configure NHibernate on Application_Start. This means that I only perform the expensive task of setting up all of the mappings once for my WCF Service.
The only problem with this is that if the database was unavailable during start up, the...
Ayende has a great example of using the <any> mapping here, which I am reposting as part of my question since comments are closed on that blog post. Given his original mapping:
<class name="Order" table="Orders">
<id name="Id">
<generator class="native"/>
</id>
<any name="Payment" id-type="System.Int64" meta-type=...
I have a User, some of which are an employee. This is a one-to-one relationship and not all users are employees.
When I get a user it doesn't seem to be bring back the employee information it just has it marked as null. I thought I have got my head around nhibernate but I have tried playing with so many properties on the mapping files a...
I am trying to use NHibernate to map a legacy database which uses a decimal(9,0) (~32 bit integer) "version property" (for optimistic locking of each row).
The fields are declared nullable in the database, and in section 5.1.7 of the NHibernate reference manual it states:
Version numbers may be of type Int64, Int32, Int16, Ticks, Ti...
I have this query
var temp = from x in ActiveRecordLinq.AsQueryable<Circuits>()
where x.User_Created == false
orderby x.Description
select x;
From NHibernate Profiler
Query duration
-Database only: 7ms
-Total: 835ms
The query generated:
SELECT this_.Circuit...
I have a process where I create multiple new entities. I've tried adding them to a collection (doing a .Persist() on them), and then when my collection is ready, trying to commit the transaction.
I've checked to make sure that no database calls are being executed until I call Transaction.Commit(), but once I call commit, I see calls be...
I have the following (using Fluent NHibernate):
public class BuildAuditMap : ClassMap<BuildAudit>
{
public BuildAuditMap()
{
Table("BUILD_AUDIT");
CompositeId()
.KeyProperty(x => x.AuditDate, c => c.ColumnName("AUDIT_DATE"))
.KeyProperty(x => x.PersonId, c => c.ColumnName("PERSON_ID"));
...
I'm trying to figure out why nhibernate handles one-to-many cascading (using cascade=all-delete-orphan) the way it does. I ran into the same issue as this guy:
http://stackoverflow.com/questions/706673/forcing-nhibernate-to-cascade-delete-before-inserts
As far as I can tell NHibernate always performs inserts first, then updates, then ...
My object model is the following:
Item has many Tags and a Tag could belong to many Items
I'd like to execte the following query using criteria's.
SELECT * FROM Item item
where item.Id in (Select it.ItemId from dbo.ItemToTags it where it.Tag_id = 'ONE')
and item.Id in (Select it.ItemId from dbo.ItemToTags it where it.Tag_id = 'TWO')
...
I am working on a silverlight application and I am using RIA data services and nHibernate.
Currently, I have an entity with a one to many relationship to another entity.
public class Employer {
[Key]
public virtual int Id { get; set; }
public virtual string Name { get; set; }
}
public class Person {
[Key]
public ...
Question: I get an exception serializing this class to a nHibernate xml file ({"Could not determine type for: System.Drawing.Image, System.Drawing, for columns: NHibernate.Mapping.Column(Settings)"}).
How to map System.Drawing.Image to nHibernate ?
And what MS-SQL dbtype is to be used?
using System;
using System.Collections.Generic;
us...
My issue involves updating an entity via an edit form with a reference to another entity represented by a drop down list. I'm using ASP.NET MVC 2. Details:
Public Class Category
{
int Id { get; set;}
string Name { get; set}
Category Parent { get; set}
}
An edit page for the category generated by EditorFor
Edit page contain...
CreateMultiQuery is recommended when we want to eagerly load entity with its subentities with a single roundtrip - less columns returned as we don't have X*Y*Z*T but rather X, X*Y, X*Z, X*T. This is working well for me, but it's not optimal as if X is a table with many columns, I pull a lot of data from the DB. example:
const string que...
I'm building a web application and using lazy-loading as default. I would like the application to keep going even if I "forgot" (or did it by purpose) to load some sub-entities. This will make the application robust enough to avoid NullReferenceException.
BUT - I do want to count, somehow, the number of times lazy loading happened and l...
Hi, I have an issue when deleting a child record from the session. Here are the entities i have defined:
public class ReportedData
{
public virtual int ReportedDataID { get; set; }
public virtual ReportedDataTypes Type { get; set; }
public virtual string Reason { get; set; }
public virtual IList<ArticleCommentReported>...
Hello,
I have a class that contains a list of objects, say a list of cars :
class Garage
{
public virtual List<Car> cars
{
get;
set;
}
}
The reason I can't directly serialize this list is that the type Car could have a lot of subclasses, and themselves could have other subclasses, and I'd like to avoid upd...
Why does the following HQL query fail?
string hql = @"delete MyLog log
where
log.UtcTimestamp < :threshold and
log.Configuration.Application = :application";
session.CreateQuery(hql)
.SetDateTime("threshold", threshold)
.SetEnum("application", this.application)
...