简体   繁体   中英

C#: GroupEvent inaccessible due to its protection level

here is my GroupNews model :

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; }

}

and the repository :

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>
{
}

but GroupEvent is inaccessible due to its protection level.

Change

class GroupEvent

to

public class GroupEvent

use public access specifier, by default it's Internal use

public class GroupEvent

Visit MSDN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM