I have an ASP.net MVC application that is using NHibernate under the covers for data access. I'm using the Windsor container to handle injecting ISession references into each controller.
This works great, but now I'm looking to expand my application with a pluggable architecture so that I can have a core product and specific add-ons. ...
HI,
I have the following entities I'm trying to map:
public class Product {
public int ProductId { get; private set; }
public string Name { get; set; }
}
public class SpecialProduct : Product {
public ICollection<Option> Options { get; private set; }
}
public class Option {
public int OptionId { get; private set; }
}
An...
Here is the component for which I want to configure mapping
public class Range<T> : ValueObject
{
public virtual T Start {get; set;}
public virtual T Finish {get; set;}
}
In my domain I have many entities which have properties like Range < DateTime>, Range < int > ... for a particular class with property x we configure the c...
Hello Guys!
I have a Question class in ActiveRecord with following fields:
[ActiveRecord("`Question`")]
public class Question : ObcykaniDb<Question> {
private long id;
private IList<Question> relatedQuestions;
[PrimaryKey("`Id`")]
private long Id {
get { return this.id; }
set { this.id = value; }
}...
How can i create a 3 table schema from the following model classes.
public class Product
{
public int Id {get; set;}
public string Name {get; set;}
public IList<Photo> Photos {get; set;}
}
public class Photo
{
public int Id {get; set;}
public string Path {get; set;}
}
I want to create the following table structure in the da...
I have a LINQ query that searches for multiple keywords on multiple columns. The intention is that the user can search for multiple keywords and it will search for the keywords on every property in my Media entity. Here is a simplified example:
var result = repository.GetAll<Media>().Where(x =>
x.Title.Contains("Apples") || x.Descri...
I've been sitting here for an hour trying to figure this out...
I've got 2 tables (abbreviated):
CREATE TABLE TRUST
(
TRUSTID NUMBER NOT NULL,
ACCTNBR VARCHAR(25) NOT NULL
)
CONSTRAINT TRUST_PK PRIMARY KEY (TRUSTID)
CREATE TABLE ACCOUNTHISTORY
(
ID NUMBER NOT NULL,
ACCOUNTNUMBER VARCHAR(25) NOT NULL,
TRANSAMT NUMBER(38,2) NOT NULL
PO...
What is the meaning of "Unit of Work" concept in NHibernate and other ORMs?
...
Hi.
I have the fallowing problem:
I have to tables SalesHeader and SalesPosition - where SalesPosition is a child of SalesHeader.
Now. In table SalesHeader, there is a persistent Entity X. I try now to persist an Entity in SalesPosition with only give this Entity the Key to X (of SalesHeader). NHibernate does not have to save some data ...
Hello, i need some help with c# and nhibernate.
I'm working on a project that requires the entity classes to be generated from hbm files at runtime.
I get the mapping files from a service, and then need to generate the classes dynamicaly and configure nhibernate to use them.
The problem is that i'm new to nhibernate and not much of a pr...
Problem: If I pass a class with value semantics (Equals method overridden) to NHibernate, NHibernate tries to save it to db even though it just saved an entity equal by value (but not by reference) to the database. What am I doing wrong?
Here is a simplified example model for my problem:
Let's say I have a Person entity and a City enti...
Hello,
so I'm new to NHibernate and have a problem. Perhaps somebody can help me here.
Given a User-class with many, many properties:
public class User
{
public virtual Int64 Id { get; private set; }
public virtual string Firstname { get; set; }
public virtual string Lastname { get; set; }
public virtual string Username...
i have a very simple entity
public class PortalStat
{
public virtual int ID { get; set; }
public virtual Guid ProductGuid { get; set; }
public virtual DateTime StatDateTime { get; set; }
public virtual DM.Domain.Portal Portal { get; set; }
public virtual int Count { get; set; }
}
i ...
I have the following mappings of which Im trying to bring back 0 - 1 Media Id associated with a Product using a left join (I havnt included my attempt as it confuses the situation)
ICriteria productCriteria = Session.CreateCriteria(typeof(Product));
productCriteria
.CreateAlias("ProductCategories", "pc", JoinType.InnerJoin)
.Create...
Hi,
I have to read in a large record set, process it, then write it out to a flat file.
The large result set comes from a Stored Proc in SQL 2000.
I currently have:
var results = session.CreateSQLQuery("exec usp_SalesExtract").List();
I would like to be able to read the result set row by row, to reduce the memory foot print
Thanks
...
How do i set the Access Strategy in the mapping class to point to the base _photos field?
public class Content
{
private IList<Photo> _photos;
public Content()
{
_photos = new List<Photo>();
}
public virtual IEnumerable<Photo> Photos
{
get
{
return _photos;
}
}
public virtual void AddPhoto() {...}...
I am retrofitting a very large application to use NHibernate as it's data access strategy. Everything is going well with AutoMapping. Luckily when the domain layer was built, we used a code generator. The main issue that I am running into now is that every collection is hidden behind a custom class that derives from List<>. For example
...
hey guys, we have a loop that:
1.Loops over several thousand xml files. Altogether we're parsing millions of "user" nodes.
2.In each iteration we parse a "user" xml, do custom deserialization
3.finally, in each iteration, we send our object to nhibernate for saving. We use:
.SaveOrUpdateAndFlush(user);
This is a lengthy process, an...
Even after successful transaction.Application connection with the database persist.in
Nhibernate log it shows
Nhibernate Log
2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> -
executing flush
2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <
(null)> - r...
Sometime i m getting this problem in my NHibernate log .My application stops at that moment.
Updated wityh data configuration.
Even after successful transaction.Application connection with the database persist.in
Nhibernate log it shows
Nhibernate Log
2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <...