NHibernate

 20 Minutes
 10 Questions


This test is designed to assess a candidate's knowledge of the basics of technology and NHibernate. It will cover topics such as the fundamentals of NHibernate, how to configure and use it, and how to integrate it with other technologies. The test will also include questions about best practices for using NHibernate in various scenarios.


Example Question:

Multiple-Choice
What will happen when you run the below code?
public class ProductItem : BaseClass<ProductItem>
{
public virtual int ProductItemId { get; set; }
public virtual string Text { get; set; }
public virtual IList<ProductItem> Children { get; set; }
public virtual ProductItem Parent { get; set; }
public ProductItem()
{
Children = new List<ProductItem>();
}
}
class ProductItemMap : ClassMap<ProductItem>
{
public ProductItemMap()
{
Id(x => x.ProductItemId);
Map(x => x.Text);
HasMany(x => x.Children).KeyColumn("ParentId").Not.LazyLoad().Fetch.Select();
References(x => x.Parent).Not.LazyLoad().Fetch.Select();
}
}
using (var session = NHibernateHelper<T>.OpenSession())
{
var CC = session.CreateCriteria(typeof(T));
CC.SetFetchMode("Children", FetchMode.Lazy);
return CC.List<T>();
}