Search code examples
c#repository-patternddd-repositoriesrepository-design

EntityBase and IAggregateRoot Reference not found?


I am trying build a repository, so I found this link explained very well but I got error

Error 1 The type or namespace name 'EntityBase' could not be found (are you missing a using directive or an assembly reference?)

Error 2 The type or namespace name 'IAggregateRoot' could not be found (are you missing a using directive or an assembly reference?)

My Code is

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Linq.Expressions;

namespace DapperAndSQLite
{
    public interface IRepository<T> where T : EntityBase, IAggregateRoot
    {
        void Add(T item);
        void Remove(T item);
        void Update(T item);
        T FindByID(Guid id);
        IEnumerable<T> Find(Expression<Func<T, bool>> predicate);
        IEnumerable<T> FindAll();
    }
}

Here is Screenshot (To show the assembly or something is missing)

enter image description here

Am I missing Something ?


Solution

  • You haven't added the Interface IAggregateRoot and EntityBase in your project. Referenced article has source code hosted on github here.

    Add the interface and base class from here.