I have the following code:
public class A
{
private ISessionFactory _sf;
A(ISessionFactory sf)
{
_sf = sf;
}
public void SomeFunc()
{
using (var session = _sf.OpenSession())
using (var transaction = session.BeginTransaction())
{
// query for a object
// cha...
Hi,
I want to present you my windows forms application scenario:
I want to create an invoice, so I open new window with invoice details. Then I want to add new customer (to the database), that I want to use in my invoice. After entering all the information (including new customer info) I click Save to save my new document.
The questio...
I'm pulling my hair out over here and I'm not sure what's causing it.
I have the following LINQ query:
return Session.Linq<CandidateAccountEntity>().SingleOrDefault(p => p.UserName.ToLower().Equals(userName.ToLower()));
and its throwing the following error:
Index was out of range. Must be
non-negative and less than the size of...
Hello all.
I have this class that I want to persist with NHibernate. It has one collection, an IList, aggregating strings, rather than class instances, called DestinationCountryCodes.
public class RoutingRule
{
public virtual long Id { get; set; }
public virtual MessageType MessageType { get; set; }
public vi...
I have a situation where I have tables that have many columns used as a composite primary key,
worse off business logic requires these to be mutable.
I am using nhibernate and have no problems mapping for loadig/saving these. However I need to be able to update the property values and have these changes be reflected in the DB when i ...
I'm trying to create Class Table Inheritance as in ( http://www.castleproject.org/activerecord/documentation/trunk/usersguide/typehierarchy.html )
So let's say I have 2 classes:
[ActiveRecord("entity"), JoinedBase]
public class Entity : ActiveRecordBase
{
private int id;
private string name;
private string type;
...and propert...
Hey,
I'm using monorail/activerecord and was wondering how you handle adding items in a many to many relationship when the many to many table has a value in it besides just the 2 foreign keys.
For example, Business and Amenity classes have a many to many relationship so there is a BusinessAmenity table. If the BusinessAmenity table on...
I'm using NHibernate for data access. I'm working on writing some tests for my data access layer and have a scenario where I'm selecting records within a specific date range.
In test, I generate test data by just selecting random dates within a range and then I try to select records with dates within a subset o that range. For instanc...
I have parent/child relationship, and child have composite id
Parent
<id name="Id" type="Int32">
<generator class="identity" />
</id>
<set name="Children" table="CTable" cascade="all-delete-orphan" inverse="true" lazy="false" >
<key column="ParentId"/>
<one-to-many class="ChildrenClass"/>
</set>
Child
<composite...
It looks like this question: NHibernate.Linq and MultiCriteria provides a potential way to combine using Linq to NHibernate and ICriteria together in the same query (in my case, to add fulltext search predicates to Linq to NH queries).
If you wrapped the Linq to NHibernate IQueryable<T> with your own implementation, you could even inc...
Even after successful transaction.Application connection with the database persist
How much time application takes to release database connection??????
Hi ,
I am using Spring.Data.NHibernate12 on my database level.my application connection with database is not getting released.
Underneath given is Dataconfiguration.xml
<?xml versio...
I am working on my first NHibernate project, and have the following setup/requirement.
I have 2 projects xx.Data, and xx.Business. In the Data project, this is where my domain classes, mapping files are located. What I am doing is creating an online application, whereby I have a SQL table that stores the ID, modified date, and an XML fi...
I have an class which has a collection, mapped as a bag in my nHibernate mapping file for that class, and I wish to return all instances of that class whose collection has a one or more of the objects which I pass in.
Example:
My Parent Class is called DocumentDefinition. It has a collection of Roles, which is a nHibernate entity, that...
I have the following method. This returns a single unqiue order. However i just want the first result. What is the best way to achieve this. Of course i could return a List and then get the first result from that.
ie .List<Order>().SingleOrDefault();
Surely there is away through the criteria api to acheive this?
Model.Order order...
Hi,
I'm witnessing some strange behaviour from Fluent nHibernate. I have two objects involved in this problem: a "Page" object and a "Metadata" object. A Page can have multiple Metadata objects attached, and the mapping is done thus:
'in PageMap
HasMany(Function(x) x.MetaData).Cascade.All()
'in MetaDataMap
References(Function(x) x.Page...
Hi all
I'm using ASP.Net and NHibernate to build a website. Now, I need to add some sort of administration functionality, and came to think of an old django tutorial I once ran through. Here the admin page was build for me, and I could customize it as I liked.
I see no reason that I couldn't accomplish the same, somehow, in ASP.Net, wh...
Hello, I have .NET 3.5 application wrote in C# using NHibernate.
Before I has OracleClientDriver in connection.driver_class property, that say that I use System.Data.Oracle and all works fine, but for some reasons now I need using ODP, so I changed this property to: NHibernate.Driver.OracleDataClientDriver.
When I run my code I get follo...
When I try to query a table using CreateSqlQuery and convert it to an entity containing formula property, I get the below Adoexception.
"Value cannot be null.
Parameter name: fieldName"
In the first place is it possible to use the createsqlquery on entity that has formula mapping ?
...
Hi,
I think this should be simple, but I can't figure out how to do it. Suppose I have the following maps:
public class AnimalMap : ClassMap<Animal> { Id( x => x.Id); }
public class CatMap: SubclassMap<Cat> {
Extends<AnimalMap>();
Map(x => x.IsDomestic);
}
Which creates tables as I expect:
Animal
------
Id
Cat
----
Animal...
Hi, small questions about Restrictions.
i have query like this :
Where A in(1,6) and (B not like 'Value%' or B not like 'ValueII%')
the problem is the field B not contains a fixed value, can be one or more.
Please, (N)Hibernate experts - help me with this, I cant find a working solution. Any help is greatly appreciated!
...