Hello,
I've run into a nhibernate dilemma that I'm sure can be solved, cause I haven't run into a problem yet that can't be.
I have a couple of small classes:
class PropertyDataString : IPropertyData
string Value {get; set;}
void Render() { ..render string property.. }
class PropertyDataSelection : IPropertyData
string Value {ge...
I have just started to learn NHibernate, and are following tutorials. On my own learning project, I have made up a problem for myself. I have two tables:
Team:
TeamId*
Name
Match:
MatchId*
TeamAId
TeamBId
The model entities are:
Team
public virtual int? TeamId { get; private set; }
public virtual string Name { get; set; }
public v...
I have the following LINQ query:
return (from r in Repository.Query<Measurement>()
where
r.Postal.ToLowerInvariant() ==
(string.IsNullOrEmpty(postalCode)
? r.Postal : postalCode).ToLowerInvariant()
&&
r.Trait.ToLowerInvariant() ==
(string.IsN...
I have a Windows service which has a timer and in the timer_Elapsed event handler a method from another component will be called which is supposed to look into db and get or update some records.This process will happen every 2 minutes.I used nhibernate for data access in the component. When I run the method from unit test it is working f...
I have the need to persist a calculated property with an aggregate root. The calculation is based on child entities. I am using the root to add/remove the children via domain methods, and these methods update the calculate property.
A child entity can be added to a particular root by multiple users of the system. For example, UserA can ...
I have the following classes that I need NHibernate to play nicely with. How do I do it?
public class Customer
{
public int ID { get; set; }
public string Name {get;set;}
}
public class Product
{
public int ID { get; set; }
public string Name {get;set;}
}
public class CustomerPricing
{
public int ID { get; set; }
pub...
I have scoured the web and have yet to find and example that matches my requirements.
What I have is an existing multi-tenant asp.net application where all users authenticate against a single SQL Server database. This database also contains several other settings type data that is used within the application. Each client after authent...
I started out at a medium sized financial firm, and everything was done using a home brewed ORM. I've recently moved to a web shop and it's a mix of ADO.NET and linq to sql. I'm wondering what other people are using at their shops, and why? Are you happy about this, or do you wish you were using another approach?
Do-it yourself usin...
Hi,
I know that this issue has been discussed but all answers seem to be quite outdated (back in 2008).
I have a perfectly well configured application architecture with Spring.NET DI and transaction management and NHibernate. Session management works well within my integration tests.
But: what is the best way to handle the NHibernate ...
I have got an odd problem with NHIbernate, and seeing as this is my first NHIbernate project I thought I'd ask the good people of StackOverflow.com.
I'm following the 'Open session in view' pattern in ASP.Net, which opens a hibernate transaction on each request and commits it at the end of the request.
This works fine normally, howeve...
Hi,
Im pretty new to nhibernate so this may be quite straightforward but i havent found an answer on the web yet.
Lets say i have a Parent class and a Child class. The Parent Class can have many Child classes associated with it. Now when i try to load a specific Parent nhibernate also populates its Child collection for me. There ar...
Hi, i've hooked up logging in my application to automatically log changes to certain entities using event listeners. This works great but for some of the properties withing the entities i'm logging i don't wish to insert a log if only a change is made to that property. These properties are decorated with the IgnoreLoggingAttribute attr...
I've seen some docs by Fabio Maulo that shows the following params:
<id name="Id" type="Int64" column="cat_id">
<generator class="hilo">
<param name="table">hi_value</param>
<param name="column">next_value</param>
<param name="max_lo">100</param>
</generator>
</id>
However, on this question ...
Hello,
I've started using nHibernate some time ago. But after some time I saw that something goes in wrong way. The application is written in MVP pattern. Whole application is 3-tier. I have a Repository layer, Service layer and MVP. Presenter is providing a SessionWrapper to services and then it's provided to repositories. So the whole...
I'm trying to decouple the orderby on a queryover call and this doesn't compile
protected static void AddOrder<T>(IQueryOver<T, T> criteria, Expression<Func<object>> expression )
{
criteria.OrderBy(expression).Asc;
}
I'm guessing there is a way to do this, somehow bringing in the asc into the linq expression?
Thanks for the help!
...
Hello,
I'm having a strange issue when I put lazy true inside a hibernate xml.
In my class I have a property like this "Name" and a field like this "name".
When I retrive a single record against the database the I receive a classe like this:
Property: "john doe" ; field: "null".
Explaining, the property and fields are not equals.
How t...
Looking for some advice on how to update a collection on an entity. In a web app - we have a multiselect listbox allowing a user to assign and remove child entities from a list of available entities. The user would select the relevant children to associate with the parent. i.e. Product with multiple Categories it could belong to. Once th...
i have an object named party and three other objects inherit from this object, using hibernate az orm i have a problem with casting the party to ine of these objects. although i'm using not.lazyload() feature, but i see partyProxy want to be casted to department object , not exact party object . so i see:
Unable to cast object of type 'P...
I have three classes mapped using the table-per-subclass class mapping strategy. The tables are:
Images - ImageId, FileName, ImageData
CategoryImages - CategoryId, ImageId
ProductImages - ProductId, ImageId
We are mapping like so:
<class name="CatalogImage" table="Images">
<id name="Id" column="ImageId">
<generator class="guid.com...
Suppose following codes:
IEnumerable<MyClass> MakeQuery()
{
var query = from m in session.Linq<MyClass>()
select m;
return query;
}
List<MyClass> m1()
{
return MakeQuery()
.Skip(10)
.Take(20)
.ToList<MyClass>();
}
List<MyClass> m2()
{
var query = from m in session.Linq<MyClass>()
select ...