-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: nHibernate passing entities
PostPosted: Wed Feb 25, 2009 5:17 pm 
Newbie

Joined: Wed Feb 25, 2009 5:09 pm
Posts: 8
Hi,

I'm new to nhibernate and had a question about passing entities around. I have a User entity that fetches a user given the username and password.

ISession session = NHibernateHelper.GetCurrentSession();
Users usr= new Users();

try
{
IQuery lQuery = session.CreateQuery(
" FROM Users u " +
" WHERE u.UserName = :username " +
" AND u.Password = :password");

lQuery.SetParameter("username", username);
lQuery.SetParameter("password", password);
Users lReturn = lQuery.UniqueResult<Users>();
}
catch (Exception ex)
{
throw ex;
}

return usr;

I return the user entity to my c# file login.aspx.cs.

If the user exists I want to pass that user from my login.aspx.cs to my homepage.aspx.cs. Is there an easy way to do this? Can someone please give me some suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2009 6:13 am 
Beginner
Beginner

Joined: Fri Feb 27, 2009 6:07 am
Posts: 38
Location: Moscow,Russia
Sample authorized data access with NHibernate:
http://nhibernateaccessexte.codeplex.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.