Let's say I have 3 projects:
My goal is to implement a particular abstract class which is in the MyTools project in the buisness logic.
public class Client : IEntity //Project Location: Buisness Logic Project
{
public int Id { get; set; }
public string Name { get; set; }
}
public class ClientAO : BaseDAO<Client> //Project Location: Buisness Logic Project
{
}
public interface IEntity //Project Location: MyTools Logic Project
{
int Id { get; set; }
}
public abstract class BaseDAO<TEntity> where TEntity : IEntity, new() //Project Location: MyTools Logic Project
{
public static TEntity GetEntityById(int Id)
{
//Logic here to get object with ID = id
}
}
The problem is here: when I try to use ClientAO class, GetEntityById Method is not available in the web project although it is being referenced. Then if I move all the logic in the MyTools project into the business logic without changing anything, GetEntityById will be available. I cannot understand what is happening with this issue. Is there any problem with Access Modifiers? As far as I know setting a class to public, that class can be accessed even from different assembly.
If the proper references are added to your business logic project, this should work.