Update if exists and insert if not

Posted by user348731 on Stack Overflow See other posts from Stack Overflow or by user348731
Published on 2010-05-24T07:11:11Z Indexed on 2010/05/24 7:21 UTC
Read the original article Hit count: 161

Filed under:

i have a very simple entity

    public class PortalStat
    {
        public virtual int ID { get; set; }
        public virtual Guid ProductGuid { get; set; }
        public virtual DateTime StatDateTime { get; set; }
        public virtual DM.Domain.Portal Portal { get; set; }
        public virtual int Count { get; set; }
    }

i would like to make a funtion which check if there is a entity based on the Portal and the StatDateTime. if the record exist then i would like to increase the Count otherwise i would like to insert a new record.

How do i do that in nhibernate

© Stack Overflow or respective owner

Related posts about nhibernate