I have this two classes
[ActiveRecord("user_login_session_data")]
public class RecordLogSessionDao : ActiveRecordBase<RecordLogSessionDao>
{
[PrimaryKey]
public int Id { get; set; }
[Property]
public int? UserId { get; set; }
[Property]
public string UserCode { get; set; }
[Property]
public DateTime? TimeIn { get; set; }
[Property]
public DateTime? TimeOut { get; set; }
[Property]
public double Pulse { get; set; }
[Property]
public int LunchBreak { get; set; }
[Property]
public int BioBreak { get; set; }
[Property]
public int FreeBreak { get; set; }
[Property]
public int LunchUseCount { get; set; }
[Property]
public string Location { get; set; }
[HasMany(ColumnKey="SessionId", Lazy=true, Cascade=
ManyRelationCascadeEnum.AllDeleteOrphan)]
public IList<RecordLogIdleTimeDao> IdleTimeList { get; set; }
}
[ActiveRecord("record_log_idle_time")]
public class RecordLogIdleTimeDao : ActiveRecordBase<
RecordLogIdleTimeDao>
{
[PrimaryKey]
public int Id { get; set; }
[Property]
public int? UserId { get; set; }
[Property]
public string UserCode { get; set; }
[Property]
public int? SessionId { get; set; }
[Property]
public DateTime? TimeIn { get; set; }
[Property]
public DateTime? TimeOut { get; set; }
[Property]
public int? Duration { get; set; }
[Property]
public int? ProjectId { get; set; }
[Property]
public string ProjectTitle { get; set; }
[Property]
public int? ActiveProjectId { get; set; }
[Property]
public string ActiveProjectTitle { get; set; }
[Property]
public string Remarks { get; set; }
[Property]
public int? RemarksByUserId { get; set; }
[Property]
public string RemarksByUserCode { get; set; }
[Property]
public string Location { get; set; }
[BelongsTo("SessionId", Lazy=FetchWhen.OnInvoke)]
public RecordLogSessionDao ParentSession { get; set; }
}
One thing I noticed is you can't omit the "ParentSession" property in the
RecordLogIdleTimeDao.
The problem is that whenever I saved an instance RecordLogIdleTimeDao, I
get a Out of index error. I had worked with a few nhibernate projects and I
understand that this error refers to the Property "SessionId" which cannot
be repeated. Since I explicitly included SessionId and the ParentSession
property, I won't be able to save the object because if I do, the error
occurs.
How do I explicitly set the SessionId in this situation?
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.