Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

VB.Net: Simple queries in Linq To NHibernate

From Wiki

Revision as of 11:43, 14 April 2010 by chrissie1 (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Given the following Class

  1. Public Class Person()
  2.   Private FirstName as String
  3.   Private LastName as String
  4.  
  5. ...
  6.  
  7. End Class

You can look for al Persons with LastName "Baes" like this

  1. Dim  _Query = From e In _Session.Linq(Of Person)() Where e.LastName.Equals("Baes")  Select e
  2. _Persons = _Query.ToList

this would be the same as writting the following in HQL.

  1. _Query = _Session.CreateQuery("FROM Person e Where e.LastName=:Name")
  2. _Query.SetString("Name","Baes")
  3. _TexCases = _Query.List(Of Person)()

696 Rating: 2.5/5 (2 votes cast)