Hey, So I may be completely off the mark here but I'm still new to nhibernate so bare with me.
I've read this article
http://www.mattfreeman.co.uk/2009/01/nhibernate-21-trunk-entity-name-some-inheritance-and-dynamic-component/
And am looking for a way to dynamically change my mapping at runtime to bind to a different table using a on...
I have implemented a service which uses a DAOFactory and a NHibernate Helper for the sessions and transactions. The following code is very much simplified:
public interface IService
{
IList<Disease> getDiseases();
}
public class Service : IService
{
private INHibernateHelper NHibernateHelper;
private IDAOFactory DAOFactory;...
I have a scenario where I want to persist document info record to a table specific to the typo of document, rather than a generic table for all records.
For example, records for Invoices will be stored in dbo.Doc_1000 and records for Receipts will be stored in dbo.Doc_2000 where 1000 and 2000 are id autogenerate and store in well-known...
Suppose I have a database like this:
This is set up to give role-wise menu permissions.
Please note that, User-table has no direct relationship with Permission-table.
Then how should I map this class against the database-tables?
class User
{
public int ID { get; set; }
public string Name { get; set; }
pu...
I have a simple parent/child tables. Contract is the parent table. Each contract can have multiple units.
Here is my C# class definitions (simplified):
public class Contract : EntityWithIntID
{
public virtual string ContractNum { get; set; }
public virtual IList<Unit> Units { get; protected set; }
public virtual int N...
Hi,
This is the first time I am working with FluentNhibernate Mapping and facing a question of how to reference another table. Any help is appreciated:
I have several tables named CD_varname and all these contain two columns - CODE and DESCR.
I have one main table called Recipient and it has, say two columns, called ALIVE and SEX, bot...
I am trying to get sql like the following using NHibernate's criteria api:
SELECT * FROM Foo
WHERE EXISTS (SELECT 1 FROM Bar
WHERE Bar.FooId = Foo.Id
AND EXISTS (SELECT 1 FROM Baz
WHERE Baz.BarId = Bar.Id)
So basically, Foos have many Bars and Bars have many Bazes. I wa...
Hi,
I'm trying using NHibernate.Search to get Lucene.NET Score through projections.
My domain object implements an interface IScorableEntity
public interface IScorableEntity
{
float Score { get; set; }
}
...
IFullTextSession session = Search.CreateFullTextSession(database.Session);
IFullTextQuery textQuery = session.CreateFullT...
We have a very strange error that sometimes we get this error when we want to save something from our WCF service. The object that we are saving contains NO invalid datetimes, we all check them before we save. When we see this error the database hangs sometimes and the WCF is in a faulty state. When I restart the DB and the IIS web app w...
Hi folks,
I'm working on an application framework that is supposed to be mostly modular, meaning once the framework is done, all business intelligence is incorporated in plugins that can be included via config.
Most modules have the common aspect that they use NHibernate to access a database, and often they use the same tables.
What ...
Hi!
I want to create the following T-SQL statement:
SELECT SUM (sa.Amount) as 'SumAmount',
SUM(sa.Cost) as 'SumCost',
gg.[Description] as 'Goodsgroup', Month(sa.[Date]) as 'Month'
FROM SalesmanArticle sa
INNER JOIN Article a
ON a.ArticleId = sa.ArticleId
INNER JOIN GoodsGroup gg
ON gg.GoodsGroupId = a.GoodsGr...
We are trying to implement the Microsoft Sync Framework into our application that persists it's domain using NHibernate.
One of the problems we encountered is that after the Sync Framework has altered your initial database structure (adding shadow tables and triggers) NHibernate seems to get upset by throwing an toomanyrowsaffectedexcep...
In my application I have a situation where we need to capture the when a record was created and modified and what user performed those actions. So I might have an object something like:
public class Product
{
int Id;
int Name;
DateTime CreatedOn;
int CreatedByUserId;
DateTime LastModifiedOn;
int LastModifiedByUserId;
}
W...
The scenario is as follows,
I have 3 objects (i simplified the names) named Parent, parent's child & child's child
parent's child is a set in parent, and child's child is a set in child.
mapping is as follows (relevant parts)
parent
<set name="parentset"
table="pc-table"
lazy="false"
fetch="subselect"
cascade="a...
If you have a set of tables in the database that strictly consist of a string description and an ID, what is the best way to load these via NHibernate?
So suppose I have a Sandwich class, and a sandwich has a meat, a cheese, and a vegetable, where those three things are lookup tables in the DB. It seems to be the most conformant to NHi...
Does anyone know if there are any ORM tools or Code Generation tools that work against an Advantage Database?
...
How do you pass a list of things for the 'in' clause in Nhibernate HQL?
e.g.
// data input from the user interface, not known at compile time
object[] productIds = {1, 17, 36, ... };
string hqlQuery = @"
from Product as prod
where prod.Id in ( ? )";
HqlBasedQuery query = new HqlBasedQuery(typeof(Product...
We are using NHibernate Search in an application which is going to be clustered.
I have been reading up on the approaches for maintaining separate collections, in particular the master/slave configuration and I was wondering how to go about implementing it using MSMQ if indeed there is an implementation for this at this time. The JMS imp...
I am starting to delve into the realm of ORMs, particularly NHibernate in developing .NET data-aware applications. I must say that the learning curve is pretty steep and that a lot of things should be noted. Apparently, it actually changes the way you do data-aware applications, manner of coding, development and just about everything.
...
I have an application where the identity column is stored as an Oracle VARCHAR2(50 BYTE) but is actually a Guid. I want my model to expose it as a Guid:
class Foo
{
public Guid Id { get; set; }
}
Using Fluent NHibernate I don't see a CustomTypeIs() method on the IIdentityPart. I would think it would be something similar to an I...