I'm needing to foray into EF4 for the first time since experiencing the disappointment that was v1. Since then I've been a happy nHibernate user but I'm needing to pick EF back up now for a new project due to client preference.
Has anyone created a quick guide of analogies between ORM concepts for the two? If I had a translation of nH...
Dear all,
I am using these technologies: SQL Server 2005, ASP.NET MVC, NHibernate/sharp architecture and would like to mine some text with the final aim of presenting some web based stats . I have several millions of keywords and several millions of documents and would like to run some queries based on these documents indexed by the key...
I currently have a bookings model such as:
public class RoomBooking : Entity, IBooking
{
public virtual Client Client { get; set; }
public virtual Address Address { get; set; }
public virtual IList<BookingPeriod> BookingPeriods{get;set;}...
public class BookingPeriod : Entity
{
public virtual IEnumerable<IBooking> Book...
I am trying to use TransactionScope with NHibernate in order to call several methods in one transactions. Data repository methods are like this:
public virtual void Save(T dataObject)
{
try
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = I...
If using Fluent NHibernate, is it possible to automap most classes, but specify that a couple of particular classes should be mapped using the regular fluent API rather than being automapped? And if so, can anyone point me to some sample code that shows how to do it?
Thanks!
...
Hi,
I'm trying to figure what's the correct way to map the following parent child relationship. I have a parent class which contains child objects. However, the parent also has a pointer to an instance of one of the children (the PrimaryChild)
Class Parent
Public Property Id As Integer?
Public Property PrimaryChild As Child
Pu...
Where can I get the current Linq provider for NHibernate? I am also using the current release of Fluent NHibernate (1.1). Will the current Linq provider (once I find it) play nicely with fluent?
...
I am trying to map an enum property (instance of System.DayOfWeek) in my model to an integer database field.
Other enum properties in the model should be mapped to strings, so I don't wish to define a convention.
I understand that this should be possible using a fluent mapping like:
Map(x => x.DayOfWeek).CustomType<int>();
and indeed...
Hello,
I am using Fluent NHibernate in my application.
I have a criteria query that looks like this -
var query = DetachedCriteria
.For<table2>()
.SetProjection(Projections.Distinct(Projections.Property("id")))
//.Add(Restrictions.Between("date_field", startDate, endDate))
...
I'm using NHibernate and Dynamic Proxy. I have one table (Customer) with generic fields: charField1, charField2, etc. One record in this table may represent company A while another record may represent company B. However, a different domain model will exist for company A's data than company B's data because they require different informa...
Out of interest of learning what's going on behind the scenes, I am running some test methods that specifically dump data to my database via NHibernate. I'm toying with various mapping settings and am watching the session processes via the latest version of NHProfiler.
I'm noticing something odd, and it may not be of concern, but thoug...
I have a product object that contains 2 collections, accessories and consumers. Consumers relates to an accessory, the list of products that consume it. In the database I have a many to many relationship for these collections that is implemented as a linking table Product_Accessory. In mapping I have created a many to many one way for th...
We have a legacy database that we cannot change. And we are trying to move to the NHibernate instead of old DataAccess layer which is a garbage and is too slow.
it has tables like these:
GPI table has (PU_ID, PAR_ID, Data, Data2) columns
BLOCK table has (GA_ID, Data, PAR_ID) columns
COMPANY table has (PU_ID, Data) columns
I had create...
I'm wondering about a "best practice" using NHibernate, AutoMapper and ASP.NET MVC. Currently, i'm using :
class Entity
{
public int Id { get; set; }
public string Label { get; set; }
}
class Model
{
public int Id { get; set; }
public string Label { get; set; }
}
Entity and model are mapped like this :
Mapper.CreateM...
I have an entity with a surrogate Id and a composite NaturalId mapped with FluentNHibernate. I make the natural id mutable marking it "Not.ReadOnly()". Something like:
public class EntityMap: ClassMap<Entity>
{
public EntityMap()
{
Id(x => x.Id);
NaturalId().Not.ReadOnly()
...
I have a plug-in infrastructure for a project I am working on. The requirement is that I have a base class, that 3rd parties can implement. I should be able to persist these 3rd party widgets to a single table.
The idea is that I have a table in our database that looks like the following:
(I couldn't upload an image of the table becau...
I am working on a program that uses Nhibernate to persist objects, and Xml Serialization to import and export data. I can't use the same properties for collections as, for example, Nhibernate needs them to be Ilists, because it has it's own implementation of that interface, and I can't Serialize interfaces. But as I need both properties ...
Hi, I am trying to get this FluentNHibernate mapping to work. I have three tables Person, Employee and Employer. The Employee table extends the attributes of the Person table, and it's primary key is a foreign key to the Person table.
The Employee table also has a foriegn key to the Employer table. An employer can have many employees, a...
I have two entities, a team and an employee.
I want get a list of employees with eager loaded teams. The list has to be paged.
public PagedList<Employee> GetAllEmployeesWithEagerLoadedTeams(int page, int pageSize)
{
var criteria = GetSession()
.CreateCriteria(typeof (Employee))
.SetFetchMode(DomainModelHelper.GetAss...
Is there any way to get NHibernate to emit a deadlock hint? e.g. for SQL server "SET
DEADLOCK_PRIORITY LOW". At the moment I'm just executing a raw SQL query.
...