I have a table in database which has some columns like year,name and also 12 columns (m1,m2,...,m12) representing months. I would like to map this table into one class using NHibernate, ideally, these 12 mapped columns would look like:
_mappedMonths[] = new double[12];
Has anyone a solution for this ?
...
I have 3 entities:
class User {id,name...}
class UserUrl {id,user_id,url,url_type_id}
class UrlType {id,name}
My mapping:
<class name="User" table="Users" lazy="false">
<id name="id" type="Int32" column="id">
<generator class="identity" />
</id>
<property name="name" column="name" type="String"/>
<map name="Urls" table="User...
select
ts.id as status_id
, ts.status as status
, isnull(b.cnt,0) as status_count
from
task_status ts
left join (select status_id, count(*) cnt from task where assigned_to = 'XYZ' group by status_id)b
on ts.id = b.status_id
Can any one help in writing Equivalent Nhibernate query for th...
What is the best way to retrieve the list of Orders added to an ICriteria object using the AddOrder method? I believe this will have to be accomplished using Reflection, but what to reflect on?
The purpose of doing this is that I would like to pass the sort order back to the UI so an indication of the sort order can be provided to the u...
The NHibernate 2.1 download comes with 3 proxy factory classes that are available for use to enable Lazy Loading.
Castle
LinFu
Spring
What are the differences between each of them, which one should I use in particular scenarios?
...
I am using NHibernate with a SQL CE desktop database, and I'm getting an odd error when I try to do an update. SQL CE is throwing Error 25026: "A foreign key value cannot be inserted because a corresponding primary key value does not exist."
The exception occurs when performing a cascading update of a collection property of an entity ob...
I've got the following basic domain model for my MVC website accounts:
public class Account
{
public Account()
{
Details = new AccountDetails( this );
Logon = new LogonDetails(this);
}
public virtual int Id { get; private set; }
public virtual AccountDetails Details { get; set; }
public virtual...
Given this inheritance mapping:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="User" table="[User]" abstract="true">
<joined-subclass name="SubUser1" table="SubUser1">
<key column="UserId" />
...
</joined-subclass>
<joined-subclass name="SubUser2" table="SubUser2">...
Hi,
I have 3 classes :
public class Transformation
{
private int Id;
private int Type;
private int Ind;
private IList<Action> Actions;
private IList<Condition> Conditions;
private Boolean IsEnabled;
}
public class Action
{
private int m_Id;
private Transformation m_Tr...
I have a feeling this is a dumb question I should have been able to find out the answer to myself, but my searches have turned up nothing, so here I am asking the question.
I'm using Fluent NHibernate for my project and all is good. Except that Fluent spams the log savagely with all of its mapping info. I'm relatively new to NHibernate ...
Hi,
From what I understand, using something like nHibernate will return either a single result like int (say returning a count) but it can't return say 2 columns or 3 columns from the users table.
Is linq the same way?
e.g. say I have the Users table with columns: UserID, username, password, email, datecreated)
Could it return User...
I'm working on a .NET application using Silverlight on the client side. Now I've come to the point where I want to throw out my static dummy data on the server side and add a database instead.
For the database I'd love to use one of them ORM's where I can simply tag my model classes and the database tables are built for me. I did some ...
how do we do this but fluently? i know i can use 'References' but i don't need all the columns from the related table. i just need one property.
...
I'm migrating the data layer of our application to NH version 2.1.0 (from 2.0.1) and noticed the use of LinFu. I discovered that framework and want to use it in other pieces of the application, especially I want to use the LinFu.Reflection.dll, which requires a reference to LinFu.DynamicProxy and here comes the trouble, the 1.0 final ver...
Say I have a Queue table and a Job table. In the Job table there is a foreign key column QueueId for the Queue table, i.e.
Queue.Id <-- Job.QueueId
Using Fluent NHibernate it is pretty straightforward to map this to a property in the Queue class, i.e.
/* QueueMap */
HasMany(x => x.Jobs)
.KeyColumnNames.Add("QueueId");
But ass...
I would basically like to know things such as:
Advantages/disadvantages between the two?
Similarities/differences between the two frameworks?
How are they similar/different architecturally?
How much boilerplate code is needed to use each?
Can the Entity Framework be used efficiently outside of Visual Studio compared to NHibernate? Is t...
.........
<property name="Title" />
<set name ="Contacts" lazy="false" table ="Ad_Contacts">
<key column="Ad_Id"></key>
<element type ="String" column="Contact" not-null="true"></element>
</set>
.........
HasMany(x => x.Contacts).AsSet() , which is the statement I used for fluent nhibernate mapping. It doesn't work. Contacts is...
I am working on the project which uses NHibernate.
I don't keep session opened. When i need to get or save object, i open the session, do what i need and then close the session. So all the time i'm working with objects detached from session.
For example, when i need to get object from the database, i open the session, then call session...
Hi,
I've created a windows service which is listening to a MSMQ. For each message I receive, some DB transactions need to be made. Later it might be possible that there will be 1 message every second.
Currently the Nhib session is kept open until the service is stopped manually.
Is it a good practice or should I close the session after ...
Possibly a dumb question but I have a number of entities all inheriting from a base entity. The base entity does not have a table in the database. Each entity has its own table and the table definition is exactly the same. Extremely simplified example of the code is below.
public abstract class BaseEntity
{
public virtual string som...