1

这是我的 GroupNews 模型:

class GroupEvent
{
[Key]
public int GroupEvenID { get; set; }

public int GroupID { get; set; }
[ForeignKey("GroupID")]
public virtual Group RelatedGroups { get; set; }

public int EvenID { get; set; }
[ForeignKey("EventID")]
public virtual Event RelatedEvent { get; set; }

}

和存储库:

public class GroupEventRepositoryDB : RepositoryBase<GroupEvent>, IGroupEventRepository
{
    /// <summary>
    /// Initializes a new instance of the <see cref="GroupEventRepositoryDB"/> class.
    /// </summary>
    /// <param name="databaseFactory">The database factory.</param>
    public GroupEventRepositoryDB(IDatabaseFactory databaseFactory)
        : base(databaseFactory)
    {
    }
}

/// <summary>
/// GroupEvent repository interface.
/// </summary>
public interface IGroupEventRepository : IRepository<GroupEvent>
{
}

但是 GroupEvent 由于其保护级别而无法访问。

4

2 回答 2

3

改变

class GroupEvent

public class GroupEvent
于 2013-05-16T12:07:03.923 回答
1

使用public访问说明符,默认情况下Internal使用

public class GroupEvent

访问MSDN

于 2013-05-16T12:08:49.510 回答