Background for read-only entity in NHibernate

Viewed 1881

I read the chapter 10 "read-only entities" in NHibernate Reference Documentation as the following:

http://nhibernate.info/doc/nh/en/index.html#readonly

But unfortunately I DO NOT know why use read-only entities. I think I need some background to understand it, for example:

1. immutable classes means "static" class in C# code? let's use code to display it

public class entity
{
    public virtual int Id {get; }
    public virtual DateTime CreatedTime 
    {
        get; 
        //how about I add this becasue it should be set before session.Save()
        private set; 
    }

}
  1. use the read-only entities for performance reason?(no dirty-check and save memoroy)
  2. read-only entities will not be persisted forever ......

Any explanation is helpful, thanks very much in advance.

1 Answers
Related