Well… The work over uNhAddIns.WPF (announced here a month ago) is pretty done.
uNhAddIns.WPF is using some advanced feature of NHibernate and uNhAddIns as, for example, the injection of ICollectionTypeFactory to have Observable collections created directly by NHibernate.
José Romaniello has begun a new example creating a full functional application named Chinook Media Manager using :
- WPF
- NHibernate 2.1.0GA + NHibernate.Linq
- uNhAddIns + uNhAddIns.WPF (with CpBT)
- IoC + AOP by Castle
- Chinook as example DB
In the project you will see how easy, and clear, is create a Desktop application using the frameworks mentioned above.
A little example:
public class Artist : Entity
{
public virtual string Name { get; set; }
}
will become IEditableObject implementing INotifyPropertyChanged without touch the real implementation.
A class like this:
public class Album : Entity, IAlbum
{
public virtual Artist Artist { get; set; }
public virtual string Title { get; set; }
public virtual IList<Track> Tracks { get; private set; }
public virtual void AddTrack(Track track)
{
track.Album = this;
Tracks.Add(track);
}
public Album()
{
Tracks = new List<Track>();
}
}
<class name="Album">
<id name="Id" column="AlbumId">
<generator class="hilo"/>
</id>
<property name="Title" />
<many-to-one name="Artist" class="Artist" column="ArtistId" />
<bag name="Tracks" inverse="true" cascade="all">
<key column="AlbumId" />
<one-to-many class="Track" />
</bag>
</class>
will have the collection Traks implementing INotifyCollectionChanged.
Do you remember this post… well here the repository look as:
public interface IRepository<T> : IQueryable<T>
{
T Get(object id);
T Load(object id);
T MakePersistent(T entity);
void MakeTransient(T entity);
}
The first post of the series is on the cloud, follow it !
Please start downloading the example and feel free to send us your opinions, advise and so on in uNhAddIns mailing list.
Happy NHibernating even with WPF!
Hello!
ReplyDeleteI am starting development with uNhAddIns and would like to ask if you have any suggestion as the versions that would be ideal for the project. NHibernate can be used in version 3.2? Suggestions which version to use the Castle, and nHibernate uNhaddins?
I did several tests with older versions, but when upgrading to newer versions, I had many problems and did not work. so the question about versions. uNhAddIns works with newer versions of the Castle and NHibernate. If yes, how? Had some sample project to send, except Chinook?
Thanks in advance,
Gustavo Souza Gonçalves