I'm not an NHibernate user; I write a serialization utility library. A user has logged a feature-request that I should handle NHibernate proxy classes, treating them the same as the actual type. At the moment my code is treating them as unexpected inheritance, and throwing an exception.
The code won't know in advance about NHibernate (i...
I have a method that returns a resource fully hydrated when the db is SQLite but when the identical code is used by SqlServer the object is not fully hydrated. I'll explain that with the code after some brief background.
I my domain various otherwise unrelated things like an Employee or a Machine can be used as a Resource that can be al...
I saw it's possible to speed nh app with configuration serialization (e.g. http://www.lucisferre.net/post/2009/06/18/Speed-up-nHibernate-startup-with-object-serialization.aspx). Is it pssible to serialize nh configuration in medium trust env. ?
...
Our customer wants us to use a connectionstring with username = "external" and add schemaName "original" infront of our queries like:
"select columnA from original.TableA"
I dont want to change mapping files which are shared by other projects,
tried adding default schema as:
<property name="default_schema">original</property>
But t...
I have just started learning NHibernate.
Over the past few months I have been using IoC / DI (structuremap) and the repository pattern and it has made my applications much more loosely coupled and easier to test.
When switching my persistence layer to NHibernate I decided to stick with my repositories. Currently I am creating a new ses...
In a project that I am working on, I have the following entities: Analyst, Client and Contractor. Each inherit from a base class User.
public abstract class User {
public virtual int Id { get; set; }
public virtual string Username { get; set; }
public virtual string FullName { get; set; }
}
I then have the other classes in...
I'd like to program against interfaces when working with NHibernate due to type dependency issues within the solution I am working with.
SO questions such as this indicate it is possible.
I have an ILocation interface and a concrete Location type. Will the following work?
HBM mapping:
<class name="ILocation" abstract="true" table="IL...
I would like to set the default transaction level to ReadCommitted in my Fluent NHibernate configuration. If I were using XML mapping files, I could add a key to my config file:
<add key="hibernate.connection.isolation" value="ReadCommitted" />
but I can't figure out how to accomplish this with Fluent configuration.
...
You can specify the namespace and assembly to use types from at the top of HBM files:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MyCorp.MyAssembly" namespace="MyCorp.MyAssembly.MyNamespace">
Can you use types from multiple assemblies / namespaces within the same mapping file, and if so what is the syntax for doing...
Hi all,
I'm trying to achieve some kind of nested transaction behavior using NHibernate's transaction control and FlushMode options, but things got a little bit confusing after too much reading, so any confirmation about the facts I list below will be very usefull.
What I want is to open one big transaction that splits in little transa...
I'm having a case of the Mondays...
I need to select blog posts based on recent activity in the post's comments collection (a Post has a List<Comment> property and likewise, a Comment has a Post property, establishing the relationship. I don't want to show the same post twice, and I only need a subset of the entities, not all of the pos...
Hi
Trying to use FNH to map a view - FNH insists on having a Id property mapped. However not all of my views have a unique identifing column.
I can get around this with XML mappings as I can just specify a
<id type="int">
<generator class="increment"/>
</id>
at the top of the mapping.
Is there any way to duplicate this i...
I have an interface IUserLocation and a concrete type UserLocation.
When I use ICriteria, specifying the interface IUserLocation, I want NHibernate to instantiate a collection of the concrete UserLocation type.
I have created an HBM mapping file using the table per concrete type strategy (shown below). However, when I query NHibernate ...
I've done a big mistake, now I have to find a solution. It was my first project working with fluent nhibernate, I mapped an object this way :
public PosteCandidateMap()
{
Id(x => x.Id);
Map(x => x.Candidate);
Map(x => x.Status);
Map(x => x.Poste);
Map(x => x.MatchPossibility);
Map(x =>...
I need a Fluent NHibernate mapping that will fulfill the following (if nothing else, I'll also take the appropriate NHibernate XML mapping and reverse engineer it).
DETAILS
I have a many-to-many relationship between two entities: Parent and Child. That is accomplished by an additional table to store the identities of the Parent and C...
Hi
I am trying to get Windsor to give me an instance ISession for each request, which should be injected into all the repositories
Here is my container setup
container.AddFacility<FactorySupportFacility>().Register(
Component.For<ISessionFactory>().Instance(NHibernateHelper.GetSessionFactory()).LifeStyle.Singleton,
Component.F...
Hi, I'm a bit of a visual studio noob. I have just restarted a project in which I am using NHibernate. The project worked fine last time I used it but now is giving the following error.
System.IO.FileLoadException: Could not load file or assembly 'Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or...
Hi, I am excuting SQL Query using Nhibernate, here is my code
public ArrayList getDocumentsForApproval(string ReleaseId)
{
string query = string.Format("SELECT distinct doc.Id, doc.Name as Doc, doc.url as url, suser.Name as Author, ds.name, CONVERT(VARCHAR(11), doc.DateEntered, 101) as DateEntered FROM dbo.Documents doc INN...
What is Castle proxy factory in NHibernate? What is its task? What the means of proxy in this case?
...
Hi,
I have a table of Appointments and a table of AppointmentOutcomes. On my Appointments table I have an OutcomeID field which has a foreign key to AppointmentOutcomes. My Fluent NHibernate mappings look as follows;
Table("Appointments");
Not.LazyLoad();
Id(c => c.ID).GeneratedBy.Assigned();
Map(c => ...