The kind of flexibility that Activerecord gives to our DB design, we are looking at it for our DAL and build model around it. We will be creating a WCF service on top of all this. Are there any gotchas or compat issues when using NHibernate based Castle Activerecord? Specially when it comes to the DataContractSerializer that WCF uses. Si...
I am trying to configure fluent nHibernate and have this code
Assembly mappingAssembly = Assembly.ReflectionOnlyLoadFrom("LibrarySample.Model.dll");
sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005
.ConnectionString(c => c
.FromAppSetting("ConnectionString"))
.ShowSql())
.Mappings(m => ...
I am trying to decide on the best method for audit logging within my application. The main reason for the log is reporting the sequence of events (changes).
I have a hierarchy of Objects, I need to create reports when something changes on any part of that hierarchy, at a latter date.
I think that I have three options:
Have a log for...
My entity has a property which is derived from other properties
public class MyClass
{
public DateTime Deadline { get; set; }
public Severity Severity
{
return (DateTime.Now - Deadline < new TimeSpan(5, 0, 0, 0)) ? Severity.High : Severity.Low;
}
}
is there a way I can modify the following
return repository.Q...
I am using NHibernate to pull some data out of a legacy db, and I have found several cases where there is a foreign key, but the referenced row has been removed.
When I make my NHibernate mapping (using Fluent NHibernate like so:
References(d => d.Group)
.WithColumns("groupId", "dataset")
.SetAttribute("lazy", "true");
) I ge...
I've the following class:
public class Customer
{
public virtual int CustomerID { get; protected set; }
public virtual string AccountNumber { get; protected set; }
public virtual string CustomerType { get; set; }
public virtual int TerritoryID { get; set; }
public virtual SalesTerritory Territory { get; protected set...
I'm using SqlServer to drive a WPF application, I'm currently using NHibernate and pre-read all the data so it's cached for performance reasons. That works for a single client app, but I was wondering if there's an in memory database that I could use so I can share the information across multiple apps on the same machine. Ideally this wo...
I have been looking around for some example projects or tutorials on Linq to Nhibernate.
Does anyone know of any good ones?
...
I'm looking for a framework to simplify the creation of a website with social networking features and plenty of custom functionality.
I'm quite keen to use an ORM like nHibernate or similar for data access.
Would DotNetNuke be a good choice? Or are there other options which are better.
Added: I'm quite keen not to have to reinvent the...
I use NHibernate in my ASP.NET application to connect to an MS SQL Server 2005 database. In some cases I need to write my own SQL queries. However, I noticed that the SQL server thread leaks about 50 KB of memory every time I execute the following piece of code:
NHibernate.ISession session = NHibernateSessionManager.Instance.GetSession(...
I'm trying to configure nHibernate to use a MySql database. I found examples for mssql and sqlite but none for mysql.
So, how do I change this so it uses mysql:
Fluently.Configure().Database(
MsSqlConfiguration.MsSql2005.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString")
)
)
.Map...
I'm revisiting and re-implementing the code that caused me to ask this question about data auditing in NHibernate. However this time, I want go with Sean Carpenter's suggestion and implement the ISaveOrUpdateEventListener (new in NHibernate 2.x)
I want to add a row in a database for each change to each property with the old value and t...
Hi all:
I was wondering if anyone has tried to do this in NHibernate.
I have the following tables (simpify version).
CITY:
city (varchar2) (PK)
province (varchar2) (PK)
CITY_TL:
city (varchar2) (PK)
province (varchar2) (PK)
lang (char (2)) (PK)
LOCATION:
location (varchar2) (PK)
some other column.
As you can see, there are no relat...
I am using: NHibernate, NHibernate.Linq and Fluent NHibernate on SQL Server Express 2008. I am selecting an entity using a predicate on a referenced property (many-one mapping). I have fetch=join, unique=true, lazy-load=false. I enabled the log4net log and when any such query executes it logs two identical SQL queries. Running the query ...
Hi there!
Looking for an answer on how to configure NHibernate to support my scenario, an many-to-many map with an objectified relation.
I have a colection of Person:s with relations to other Person:s. Each of the relations have an attribute specifying what type of relation they have. In an RDB this is done by using a many-to-many tabl...
Calling Get in the following code works fine:
public class ContractService : IContractService
{
private readonly IRepository<Contract> repository;
public ContractService(IRepository<Contract> repository)
{
this.repository = repository;
}
public Contract Get(int contractId)
{
return repository.Query()....
I've been using NHibernate for a while now and have found from time to time that if I try to request two pages simultaniously (or as close as I can) it will occasionally error. So I assumed that it was because my Session management was not thread safe.
I thought it was my class so I tried to use a different method from this blog post h...
I have what I think is a rather common use case for NHibernate. I create an entity and try to save it using ISession.Save() followed by a Transaction.Commit(). At this point, I expect violations of things like unique/primary key constraints to come up to me as exceptions. What I'm seeing, however, is just a GenericADOException. This does...
I tried to find tutorials/articles on using UnitOfWorkApplication in ASP.NET (not MVC). But all information I can find is about how to use it in ASP.NET MVC.
Does it mean that it is not possible to use Rhino.Commons.HttpModules.UnitOfWorkApplication in our old webform applications?
I run into the problem that I am using repository inh...
typically definition of property/column looks like this:
<property name="DocumentSummary" column="DocumentSummary" length="100" type="String">
<column name="DocumentSummary" />
</property>
I was assuming that NHibernate will validate data using length attribute before inserting/updating a row. Unfortunately it seems to be invalid a...