Hi, I'm new to ADO.net data services (and to .net in general too..), I'm having this project where I need to setup a data service to read and write to a database with nHibernate, I've created the service:
[WebGet]
[SingleResult]
public Factory Factories(int Id)
{
try
{
Factory[] results = this.Cur...
Is there any way to set-up a symmetric self-join relationship mapping in NHibernate? Suppose we have two tables:
Users
id
Relations
id
user1
user2
relation_type
The User and Relation classes should look like this:
class User
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public ...
Hello,
I have an NHibernate application that currently makes use of a SQL Server user-defined function. I would like to avoid having to call this function, and instead express its logic using the NH criteria API. Unfortunately, I'm having difficulty applying the criteria examples in the NH documentation to my particular case. So I'm tur...
When I just Create the Factory, It seems to do a lot of work (in the log4net console) when it start without me asking him to do anything. could it be that those are just tests he does for himself?
...
Hi There
I have been using the ncommon framework (http://code.google.com/p/ncommon/) with nhibernate and asp.net mvc. I really like the implementation of the unit of work pattern, but am having problems with lazy loading in my views. I am looking how to implement the session per request pattern with ncommon or look at another framework ...
I’m looking for a way to have fine grained control over what is saved using Entity Framework, rather than the whole ObjectContext.SaveChanges(). My scenario is pretty straight forward, and I’m quite amazed not catered for in EF – pretty basic in NHibernate and all other data access paradigms I’ve seen. I’m generating a bunch of data (in ...
I know NHibernate is an ORM and it isn't normally used to create tables but I also know that NHibernate is able to create an entire database given some mappings.
I would like to know if there is an obscured API that I could use to dynamically create/alter/delete tables. I could do it with ADO.Net but I would like to abstract the code fo...
To use nhibernate attribute mapping, do you need a special dll?
I did:
using NHibernate.Mapping;
but for some reason when I did:
[NHibernate.Mapping.Attributes.Class(Lazy=true)]
public class MyClass
{
}
the word 'attributes' is in red i.e. vs.net didn't find the assembly reference?
...
Hi,
I just started using StructureMap in my MVC apps, and everything goes fine, excepts handling my ITranscation the correct way.
What I want to do is create a new ISession on each request. Together with this I want to start a transcation.
On the end of the request I will commit the transcation.
My question is, how can I do this the...
My class looks like:
public class User
{
public virtual int ID {get;set;}
public virtual string Username {get;set;}
}
Table:
User
-UserID INT NOT NULL,
-Username NVARCHAR(50) NOT NULL
UserID is the PK, IDENTITY.
How would I use nhibernate attribute mapping for my class?
...
This strikes me as an odd problem.
I have two classes representing tables in my database. The first simply has an int ID field and a varchar NAME field; it's *.hbm.xml mapping file contains the following (everything works as expected with this model):
<class name="CBaseDataProvider.Models.PC, CBaseDataProvider" table="pc">
<id ...
I am having trouble using NHibernate's FutureValue method and nullable types. Is this a deficiency of NHibernate, or is the bug on my end? I can't think of a good work around.
This is the query I am trying to run:
Session.CreateCriteria<MyEntity>()
.SetProjection(Projections.Min("NullableDecimalProperty"))
.FutureValue<decima...
Hi,
I have a many to many relationship between Candidates and Positions. I am trying to limit the list of positions fetched to as follows
ICriteria criteria = this.GetSession().CreateCriteria(typeof(Candidate), "c");
criteria.CreateAlias("c.Positions", "plist",NHibernate.SqlCommand.JoinType.InnerJoin);
criteria.CreateAlias("plist.item...
I've discovered PARSENAME function as a good choice to order IP address stored in Database. Here there is an example.
My issue is I'm using Hibernate with named queries in a xml mapping file and I am trying to avoid the use of
session.createSQLQuery(..)
function.
I'm wondering if exists any PARSENAME equivalent function for HQL querie...
I am developing a ASP.NET MVC web app under .NET 3.5, NHibernate and hosted on Windows Azure. When, the webapp is run from the local development fabric it works fine. Yet, when I move it to Windows Azure, every insert performed from the MVC web role ends up with the exception listed below.
Any idea what's wrong with my NHibernate logic...
One thing that keeps stumping me, and I do not see much mention of it in books/blogs, is how to handle DB operations in a system that really don't fall under the jurisdiction of DAOs or Repositories. I like using the approach of generic DAOs/Repositories to handle common DB operations, but what about dealing with things that aren't entit...
I have a consignment class that aggregates a FreightDateTime class. At the same time, the FreightDateTime class is also aggregated by the GoodsItem class. In the same manner, FreightDateTime is associated with a number of other classes that I left out for now.
To avoid a databasetable FreightDateTime with ConsignmentId foreign key, a ...
Hello, I'm designing a data model using Fluent nHibernate and I'm wondering how to visualize entites, relations and stuff for documentation purposes.
This is my first project using Fluent nHibernate. My previous projects were build on Linq2Sql but recently I was a bit annoyed about some L2Q concepts and finally I decided to do a switch ...
I am using Fluent NHibernate on a project that has an Oracle 10g database. I am also using SQLite with a schema generated from my mapping for testing. The problem I am having is that, since the primary keys on my tables are generated by Oracle Sequences, to get my Add methods to work correctly I had to add .GeneratedBy.Sequence({sequenc...
I have a method that will return a list of suggested orders. If the user passes a null that criteria is ignored.
public IList<SuggestedOrderItem> GetSuggestedOrderItemByCriteria
(
int? itemNumber,
int? deptNumber
)
{
try
{
NHibernate.ICriteria criteria =...