E' appena diventato online (visto che tutt oggi che cerco di entrare, e nn ci sono riuscito...anche ora ci sono un po di problemi :D)
di tutto e di + ... almeno spero :D
E' appena diventato online (visto che tutt oggi che cerco di entrare, e nn ci sono riuscito...anche ora ci sono un po di problemi :D)
E' appena diventato online (visto che tutt oggi che cerco di entrare, e nn ci sono riuscito...anche ora ci sono un po di problemi :D)
Now that NHibernate 1.2 is finally out of Beta stage and into official Release Candidate mode, I felt it was appropriate to upgrade NHibernateRepository to use it. Not much has changed and there isn't any new functionality, but I wrote some tests for it and of course updated its references to NHibernate 1.2 RC1.
You can get the latest NHibernateRepository here.
Fonte: http://www.arcware.net/archive/2007/04/06/NHibernateRepository-Upgraded-for-NHibernate-1.2-RC1.aspx
To speed up the creation of solutions like these, I've created two templates to plug into Visual Studio to do it for you. There's one for testing with MbUnit 2.3 RTM and one for NUnit 2.2.9. Download the one you want to your VS2005 Project Templates folder and then create a new project. You'll see the options to use the templates automagically.
FONTE:
post:
http://blogs.ipona.com/dan/archive/2007/01/02/SimpleTDDVisualStudioTemplates.aspx
I started using NHibernate at the end of last year and I am having a wonderful experience with it. The simple fact that I don't have to maintain hundreds of procedures and data access abstraction classes to do basic CRUD operations is enough to justify the use of NHibernate (even though I used a custom code generation tool). Besides that, my code is amazingly clearer and simpler. I only need to worry about business and user interface logic now. All that pluming code has gone for good.
I had zero experience with ORM frameworks, so on the first couple of weeks using NHibernate I had a hard time with some issues, like using it with ASP.NET disconnected objects and abstracting NHibernate sessions from the domain layer. After putting in some effort I came out with a nice architecture that abstracts the NHibernate layer and allows me to work with an ASP.NET session.
I am assuming you already have some familiarity with NHibernate. If you are new to NHibernate I encourage you to go to the website and download the reference documentation. I am using NHibernate 1.2 CR1 in this article.
The idea here is to keep my business objects unaware of an NHibernate session. So I created a different project for NHibernate stuff, called Shared.NHibernateDAL. It includes the session and transaction manager classes. I also created a common business object that serves as a base class for all my business entities. This class (BusinessObject) encapsulates the common methods and properties all entities that need to be persisted have, like Save(), Delete(), ID, etc.
Here's a class diagram just to give an idea:
The main classes on the NHibernateDAL project are the following:
NHibernateSessionManager – This is the class responsible for managing the NHibernate session. I've got this class from another NHibernate article on Code Project. TransactionBlock – This is a class I created to manage transactions and abstract it from NHibernate. I will show an example of its use further on this article. BusinessObject<T> - This is the base class for all the business entities I need to persist. It implements the basic CRUD methods.
LINK: http://www.codeproject.com/aspnet/NHibernateArchitecture.asp
Vediamo se riesco a pubblicare sto codicillo o ci devo diventare scemo + di quello che sono oggi :D
/*
* Created by: WaYdotNET [Carlo Bertini]
* Created: 18.34.28
* NameSpace: GestioneOttica.DomainModel.Cliente.Anagrafe
*/
using System;
namespace GestioneOttica.DomainModel.Cliente
{
public class Anagrafe
{
#region private fields
private string _nome;
private string _cognome;
private string _codiceFiscale;
private Nullable<DateTime> _dataNascita;
private string _professione;
private string _iva;
private string _ditta;
#endregion
#region protected members
#endregion
#region public properties
public string nome
{
get { return _nome; }
set { _nome = value; }
}
public string cognome
{
get { return _cognome; }
set { _cognome = value; }
}
public string codiceFiscale
{
get { return _codiceFiscale; }
set { _codiceFiscale = value; }
}
public DateTime? dataNascita
{
get { return _dataNascita; }
set { _dataNascita = value; }
}
public string professione
{
get { return _professione; }
set { _professione = value; }
}
public string iva
{
get { return _iva; }
set { _iva = value; }
}
public string ditta
{
get { return _ditta; }
set { _ditta = value; }
}
#endregion
#region system.object overrides
#endregion
#region constructor
#endregion
}
}
My blog is worth $0.00.
How much is your blog worth?