I would like to know which is the common practice for a domain implementation. Designing the business objects first, that need persistence or the database schema first, generating it from an entity relationship diagram (and afterwards the ORM poco*'s)?
I am going to start a solution, but I would like to know which is the most preferabl...
I'm writing an ASP.NET MVC application using NHibernate as my ORM. I'm struggling a bit with the design though, and would like some input.
So, my question is where do I put my business/validation logic (e.g., email address requires @, password >= 8 characters, etc...)?
So, which makes the most sense:
Put it on the domain objects the...
Can someone please help me understand the following:
In the previous version of NHibernate (2.0.1) the following property will
validate and is compatible with the Castle Proxies:
internal virtual BusinessObject Parent
{
get { /*code*/ }
}
However, in 2.1 it errors saying that the types should be
'public/protected virtual' or 'prote...
This is getting quite annoying. Trying to integrate Lucene.Net search with NHibernate and i found only some information from year 07.
Is there a nice up to date tutorial for this? Where to start, what to download etc.?
Is there a way how to set NHibernate.Search metadata elsewhere and not on domain objects using attributes (i don'...
Hi all,
So I'm currently attempting to do a promotion of objects from one database to another in my app. Basically I want to allow the user to click a button and promote changes from staging to production, as it were.
To do this, I really want to keep the IDs the same in order to help with debugging. So for example if the object has ...
I have the following domain set up for persistence with NHibernate:
I am using the PaperConfiguration as the root aggregate.
I want to select all PaperConfiguration objects for a given Tier and AcademicYearConfiguration. This works really well as per the following example:
ICriteria criteria =
session.CreateCriteria<PaperConfiguratio...
I recently spent a great deal of time pulling out a stored procedure back-end and replaced it with a NHiberante base repository. One test per repository was nice in the stored procedure version because I could verify my stored procedures worked and the class that mapped the returned data to my objects did it's job.
But after I got th...
Say I already have a Table:
Customer
First
Last
Thus I would have an object with properties such as:
Customer.First
Customer.Last
If I wanted to refactor the code so that I rename the properties:
Customer.FirstName
Customer.LastName
Is there a way to indicate to NHibernate to update First to FirstName and so on?
I already know ho...
I've been trying to interpret the answers to similar questions but haven't been able to make it work.
I have a list of activities, and each activity as a list of participants. Here are the mappings:
<class name="Activity" lazy="false">
<id name="ID">
<generator class="guid" />
</id>
<list name="Participants">
...
In my current project, we got a rather unusual request(to me). The client wants all the deletion procedure to mark a flag instead of physically delete the record from the database table. It looks pretty easy at the first glance. I just have change
public void DeleteRecord(Record record)
{
record.DeleteAndFlush();
}
public IList G...
Hello,
I set up an IInterceptor for ILoggable objects in my domain model. And on OnFlushDirty event, i am trying to save a log (audit). But while doing this, my code goes into an infinite loop.
_logrepository.Save(log) calls OnFlushDirty even if log is not an ILoggable object (it is because entity is still the previous object)
Is the...
Hello,
In my class i have the following property:
Class A
{
public virtual string Tag
{
get; private set;
}
}
And in my hbm.xml i have the following (which does not work)
<property name="Tag" access="nosetter.camelcase" />
Nhibernate can't find the backing field. Does anybody known which access stra...
I am working on a .NET web application that uses an SQL Server database with approximatly 20 to 30 tables.
Most tables will be included in the .NET solution as class.
I have written my own data access layer to read the objects from, and write them to the database.
The whole thing is consist of just a few classes and very few lines of cod...
Basically, I need to set a property to the results of a query that uses data from the parent object.
With the domain model below, I need to set the C property of EntityB using data from both EntityA and EntityB.
Also, I need to set the A property of EntityB to be the actual instance of EntityA that is its parent.
Query:
Set EntityB....
I have this domain hierarchy:
User -> EntityWithAuditDate -> Entity
Here is the domain: (simplified)
public class User : EntityWithAuditDate
{
public User(){}
public virtual string Name { get; set; }
}
public abstract class EntityWithAuditDate : Entity
{
public EntityWithAuditDate() { }
pub...
I have two distinct (no inheritance) interfaces:
IInvestable and IPricable
and two classes:
IndexClass and FundClass
that are stored in seperate tables in my DB.
IndexClass is IPriceable
FundClass is IPriceable and IInvestable.
I need a table to store prices against an IndexClass and a FundClass
I need a table to store that FundClass...
I'm using log4net with NHibernate and i'm logging SQL statements generated by NHibernate.
Is there any way to instruct NHibernate to only log DML SQL statements (inserts, updates, deletes), for example something like "NHibernate.SQL" + ".DML" in log configuration?
...
I'm trying to retrieve a list of orders based on parameters specified by a user (basic search functionality). The user will enter either an orderId or a bunch of other params, those will get wrapped up into a message, and eventually make their way to the method below. My question is, how do I only look at the parameters that actually hav...
This is possibly an easy one that I can't seem to get past.
I've created a "Product" class which has a list of "Accessories". Each "Accessory" is just another product referenced by a lookup table.
Table setup:
Product
-------
ProductID int
Name varchar(200)
AccessoryProduct
----------------
ID int
ParentProductID int
ChildProductID i...
How do I escape keyword conflicts when NHibernate generates my column names using FluentNHibernate?
NHibernate generated this for me and "Key" is a conflict.
create table Setting (
Key NVARCHAR(MAX) not null,
Value NVARCHAR(MAX) null,
primary key (Key)
)
...