I'm trying to use NHibernate for data access, and I have 2 simple entities that look like this:
public class User : IEntity
{
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string Logon { get; set; }
public string Password ...
Hi I'm using ms2005 for a simple calendaring system.
We have three 'legacy' tables: Groups, Units and Staff.
I need to give each record in the tables a unique identifier (carrying across all 3 tables).
What would be best way to approach this? I am using NHibernate and was was wondering whether that could do it for me.
Anyway, any nods...
We have three tables A, B, C.
Columns
A => id, x
B => id, y
C => A.id, B.id
For every row in A there will be a row in B.
To relate A and B we are using C (we cannot change the table design).
We have to persist information in one transaction. Is there a way to do it using NHibernate?
...
Hi, I have an entity Customer
public class Customer
{
public virtual int ID { get; set; }
public virtual string Firstname { get; set; }
public virtual string Lastname { get; set; }
}
and my DAL method is :
public IList<Customer> GetCustomers(Customer example)
{
var customers = default(IList<Customer>);
...
Hi,
I have an existing asp.net webforms project that uses Microsoft's Enterprise DAAB for the DAL, I need to implement some extensive features, and I would like to use NHibernate to make things easier.
Is there any design patterns/architectures out there that allow a hybrid DAAB/NHibernate DAL ? is it a good idea ?
My thinking is: if ...
I am able to use the NHibernate Criteria API for an IN statement using
new NHibernate.InExpression()
Is there a way using the Criteria API to get a "NOT IN" statement?
...
Hi
I having trouble getting nHibernate.Search to create an Index.
If I use 1.2.1.4 of nHibernate.dll & nHibernate.Search.dll then the index is created correctly and I can inspect it with Luke (a Lucene utility).
A segments file is created as well as a Fragments file etc
However, when I use v 2 of nHibernate.dll & nHibernate.Search.dll...
I am concentrating this question on 'reporting-type' queries (count, avg etc. i.e. ones that don't return the domain model itself) and I was just wondering if there is any inherent performance benefit in using HQL, as it may be able to leverage the second level cache. Or perhaps even better - cache the entire query.
The obvious implied ...
How to create Nested query Using Nhibernate
...
Hi,
I have a many-to-many relationship between two classes: Tournament and Players
I set Cascade.SaveUpdate in the mappings, but when saving a Tournament instance, the Players will not be saved to the Players table. Nhibernate only writes parent and child key columns in the linking table. The DB is SQLite.
These are the mappings
pub...
Hi,
I'm new to NHibernate.
If I use NHibernate to generate GUIDs for inserts to MS Sql2005, what type does the id field in the db need to be.
Any help appreciated.
Thanks
...
I have set the FlushMode property on an NHibernate session to FlushMode.Never, but when I call session.Save(User), a call gets made to the database anyway. Is this how this is supposed to work? I would think that it shouldn't do an insert until I call Flush().
Edit:
I found the issue, I changed the primary key to guid and it worked. ...
Is it possible to generate the database tables and c# classes from NHibernate config files? Afterwards, is it possible to change the config files and update the tables and config files non-destructively?
Do you recommend any tools to do this? (preferably free...)
...
Let's say you have two tables, "Users" and "UserRoles". Here's how the two tables are structured (table - columns):
Users - UserID (int)
UserRoles - UserID (int), Role (string)
What I want is for my "User" class in my domain to have an IList of roles. How do I construct my Fluent NHibernate mapping to achieve this?
...
I have two tables "Group" and "Customer" and of course two entities "Group" and "Customer".
And i have another table which is referencing both "CustomerGroupMember" table.
I use CustomerGroupMember table for many-to-many mapping.
Customer.hbm.xml
<!--Many to many-->
<bag name="CustomerGroups" table="CustomerGroupMember" cascade="a...
Hi,
I have a design issue that I would appreciate some input on.
I would like to make an calendar event system based on the following 4 tables:
tb_events
id,
date,
summary,
tb_group
id,
name,
parent,
lineage,
tb_course
id,
name,
tb_staff
id,
name,
email,
The event class is currently set up as
id
summary
date
calDetails IL...
I want to create a query which has more than 3-4 Expression.Or ? But Expression.Or just let me to add two Expressions inside it.
if (!string.IsNullOrEmpty(keyword))
query
.Add(Expression.Or(
Expression.Like("Name", keyword, MatchMode.Anywhere),
...
rowCount returns 0 when query.SetFirstResult is different from 0 ?
if the result of pageIndex x pageSize = 0 // it gives me the rowCount but when it is not equal to 0, countCriteria gives me 0 instead of rowCount.
What can i do ?
Thanks in advance
...
I have a data structure which uses composite ids (Which I dont wish to change to single)
Everything loads fine except for many-to-one joins which if the join is empty, instead of mapping the property to null, maps it to an empty proxy object. I have written an ugly work around( see bleow). Any solutions to this?
private Node _Parent;
...
For example i have two entities. "RealEstate" and "Picture". RealEstate holds a collection of Picture. In the mapping file RealEstate has a bag in it for Pictures and cascade is Delete".
If you delete a RealEstate all the related Pictures will be deleted. But is there any way to execute a custom method to delete the pictures from the we...