Skip to main content
 首页 » 编程设计

C#:GroupEvent 由于其保护级别而无法访问

2024年02月13日10artech

这是我的 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 由于其保护级别而无法访问。

请您参考如下方法:

改变

class GroupEvent 

到

public class GroupEvent