We've implemented Fluent NHibernate, but we have a need to execute a stored proc when deleting a row for a couple of tables.
Is there anyway to accomplish this without creating a command object and enlisting it with the session's transaction?
...
I'm having an issue with my linq query. I am trying to filter objects based on selected values. We use a query model which returns a System.Linq.Expressions.Expression and uses it to create an nhibernate query. Here is my linq expression.
x =>
(
request.InitialLoad
...
Hi, I am getting the error below:
Object with id: 34dd93d3-374e-df11-9667-001aa03fa2c4 was not of the specified subclass: MyNamespace.ClassA (loading object was of wrong class [MyNamespace.ClassB1])
Call stack is:
at NHibernate.Loader.Loader.InstanceAlreadyLoaded(IDataReader rs, Int32 i, IEntityPersister persister, EntityKey key, Obje...
Hello All,
I have an odd problem. I have a number of C# apps that utilize Nhibernate 2.1.
Within the last 2 days I've begun receiving the following error:
Could not load file or assembly 'NHibernate, Version=3.0.0.1001, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's
manifest defin...
I have the following tables:
A
--
Id : int
SomeString : varchar(20)
B
--
Id : int
BString: nvarchar(10)
AId : int // FK to A
I have an entity A which is already mapped to the table A.
For the entity B, I'm trying to do a composite so that I have all the data from B, as well as the fields from A. The fields from A shouldn't be cha...
I am trying to map a new domain model to a fixed-schema legacy database and am stuck on how to do a certain type of mapping. Here's a distilation of my problem.
There are types of Workers. For example an HourlyWorker and a SalariedWorker.
The data for an HourlyWorker is stored in the WORKERS table and the HOURLY_WORKERS table with a ...
I have traditionally implemented a Model-View-Presenter [Passive View] like so:
interface IView
{
string Title {set;}
}
class frmTextBox : Form, IView
{
...
public string Title
{
set { this.txtTitle.Text = value; }
}
...
}
class frmLabel : Form, IView
{
...
public string Title
{
set { this.lblTitle.Text = value; }
}
...
}
class Pres...
I have the following code:
Session.CreateCriteria<Foo>("foo")
.CreateAlias("foo.Bar", "bar")
.SetProjections(Projections.SqlProjection("bar.FirstName + ' ' + bar.LastName));
The problem is with the alias for the bar table in the SqlProjection.
The Hibernate docs say that "the string {alias} will be replaced by the alias of th...
Hi,
I have several XML files and each file contains data of ‘root objects’ which I parse using Linq to XML and then create actual root objects which I persist using NHibernate and the sharp architecture repository. I have started to optimise the data insert and manage to add 30000 objects in about 1 hour and 40 minutes to the database. ...
Im using VS2010, C# 4.0, NHibernate and NUnit in a project Im working on.. In doing database tests I've come across a wierd problem.. When I run my tests, nunit-agent.exe crashes for no apparent reason.. I've since then discovered that when i debug my tests, I get the following exception in the TestFixtureSetup method:
TypeInitializa...
Looking for a way to use SQLBase (by Unify, formerly Gupta) with NHibernate. I don't think there is a specific SQLBase provider, but I guess there would be generic providers to connect and use the most common SQL features...
Any help would be appreciated.
...
We're using SchemaExport via ActiveRecord. By default it generates a table like this:
create table List (
Id UNIQUEIDENTIFIER not null,
Name NVARCHAR(255) null,
OwnerId UNIQUEIDENTIFIER null,
primary key ( Id ))
SQL Server then defaults to adding a clustered index for the primary key. But I want this to be nonc...
In my web application, I have 2 totally different databases - one that's being used mostly by a CMS from which we'd like to get page information on non CMS pages on the same website, & one that contains totally different data.
Is it possible to use Spring.NET's Open Session In View module with multiple session factories for both of thos...
I have interface:
public interface IHasList<T>
{
IList<T> Items { get; set; }
}
And I want to map such class using one-to-many mapping to the lists:
public class Model : IHasList<A>, IHasList<B>
{
...
}
Can I do this? If yes, how to write mapping?
...
I’m using NHibernate for data access, but accessing it through a façade layer. This layer consists of interfaces for the repositories, plus an IUnitOfWork interface which corresponds to the ISession object.
In order that retrieved entities are managed correctly, repositories are passed an IUnitOfWork in their constructor and the IUnitOf...
I am attempting to query entities with HQL in order to return a list of objects. The query returns the correct number of rows, but the first entry (ie the first row returned is duplicated across all entities). What could be the cause of this problem?
The HQL query is
using (ISession session = NHibernateHelper.OpenSession())
{
...
Hi,
Got a weird nHibernate problem. I have a table called AssetRule which is being mapped with the following code:
Public Class AssetRuleMap
Inherits FluentNHibernate.Mapping.ClassMap(Of AssetRule)
Public Sub New()
Id(Function(x) x.Id)
Map(Function(x) x.PageType).CustomType(Of PageType)()
Map(Function(x) x.Path)
Map(Fu...
I have two separate queries that both return the same IQueryable, and I'd like to combine them prior to projection. It looks like neither Union or Concat are implemented in Linq to NHibernate? Does anyone know how I might go about achieving this?
...
I'm trying to modify the following code so that it will return a Dictionary<int,int> where the keys correspond to groupId and the values correspond to the total companies in the group, instead of a List<Company>
companies = _session.CreateCriteria<Company>()
.Add<Company>(x => x.CompanyGroupInfo.Id == groupId)
.List<Company>();
...
What is a Projection, in terms of database theory and NHibernate when using SetProjection()?
...