I have SOA Layer architecture for C# application. I have defined Business/ Domain Entities in Business Access Layer 'Class Library Project'.... Data Entities in Data Access Layer 'Class Library Project' and Data Contract for Server side WCF is under WCF Service 'Class Library Project'
Business Entity
namespace App.Core.Entities
{
public class Member
{
public int MemberID { get; set; }
public string Title { get; set; }
public string Surname { get; set; }
public string Forename { get; set; }
public string MiddleName { get; set; }
}
Data Entity
namespace App.DAL.Entities
{
[Table("Member")]
public class Member
{
[Key]
public int MemberID { get; set; }
public string Title { get; set; }
public string Surname { get; set; }
public string Forename { get; set; }
public string MiddleName { get; set; }
}
}
WCF Data Contract
namespace App.Services.Contracts
{
[DataContract]
public class MemberData : IIdentifiableEntity
{
[DataMember]
public int MemberID { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Surname { get; set; }
[DataMember]
public string Forename { get; set; }
[DataMember]
public string MiddleName { get; set; }
int IIdentifiableEntity.EntityId
{
get { return MemberID; }
set { MemberID = value; }
}
}
}
generic repository
public interface IGenericRepository<TEntity> where TEntity :class
{
global::System.Linq.IQueryable<TEntity> GetAll();
TEntity GetEntityByID(int id);
void InsertEntity(TEntity obj);
void UpdateEntity(TEntity obj);
void DeleteEntity(int id);
}
Unit of work
namespace App.Repository.UnitOfWork
{
public class MembershipManagement_UOF:IDisposable
{
protected Member_Repository _Member_Repository;
public Member_Repository Member_Repository
{
get
{
if (this._Member_Repository == null)
{
this._Member_Repository = new Member_Repository(_MembershipContext);
}
return _Member_Repository;
}
}
}
Now my issue is when I run code from business project, it should only talk to repository and use only Business entity for Member but it asking me to add reference from DAL in business project
here is code where I get Error
public IEnumerable<Member> GetAllMember()
{
using (var _uof = new MembershipManagement_UOF())
{
var entities = _uof.Member_Repository.GetAll();
// return entities.ToList();
return null;
}
}
error
Severity Code Description Project File Line Suppression State
Error CS0012 The type 'Member' is defined in an assembly that is not referenced. You must add a reference to assembly 'App.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. App.CoreServices C:\My Work\Credit Union Application\CreditSolutionApp\App.CoreServices\CoreServices\MembershipCore\MembershipCore.cs 23 Active