本文介绍了自我加入基表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Problem with MapHierarchy
No Problem when Task used with MapSingleType
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using Model.Common;
using System.Collections.ObjectModel;
namespace Model.Task
{
public class Task : IDataObject
{
public virtual int TaskID
{
get;
set;
}
public virtual int? ParentTaskID
{
get;
set;
}
[RelatedTo(ForeignKey = "ParentTaskID")]
public virtual Task ParentTask
{
get;
set;
}
public virtual int TaskTypeID
{
get;
set;
}
[RelatedTo(ForeignKey = "TaskTypeID")]
public virtual TaskType TaskType
{
get;
set;
}
public virtual string Category
{
get;
set;
}
public virtual string Subject
{
get;
set;
}
private ICollection<TaskContact> _TaskContacts;
[RelatedTo(Property = "Task", ForeignKey = "TaskID")]
public ICollection<TaskContact> TaskContacts
{
get;
set;
}
}
public class Appointment : Task
{
public virtual string Location
{
get;
set;
}
public virtual Nullable<bool> IsAllDayEvent
{
get;
set;
}
public virtual Nullable<System.DateTime> ProjectedStartDate
{
get;
set;
}
public virtual Nullable<System.DateTime> ProjectedEndDate
{
get;
set;
}
public virtual string RecurrencePattern
{
get;
set;
}
}
public class TaskContact : IDataObject
{
public virtual int TaskContactID
{
get;
set;
}
public virtual int TaskID
{
get;
set;
}
[RelatedTo(ForeignKey = "TaskID")]
public virtual Task Task
{
get;
set;
}
}
}
推荐答案
您可以发布两个映射示例吗?使用MapSingleType和MapHierarchy?
Can you post the two examples of mapping you are using with MapSingleType and MapHierarchy?
非常感谢,
Rowan
Many Thanks,
Rowan
这篇关于自我加入基表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!