The IEntityRepository interface specifies what is required for entity data access. On the other hand, IEmployeeDal indicates that its subclasses are responsible for the Employee Data Access.
I use EntityFramework in this project.
CompanyContext class allows to return a DbSet of our database.
EfEntityRepositoryBase is a generic class that takes TEntity and TContext. (TEntity must be a class of IEntity and TContext is the DbContext)
In this class the program does all of the database actions. Furthermore I use a class that EfEmployeeDal, which inherits from EfEntityRepositoryBase. It allows to if we add new table in our database, we have to just add new class such as EfNewTableDal.
I create an interface called IEntity to understand which class implements this interface. In other words, which class is an entity class.
Employee class keeps the columns of the Employee table.
Business class library was created for controlling data access.
IEmployeeService is an interface that keeps data access methods. Even if I change the data access type, I have to just change the I...Dal object.
In this class I have all of the queries. I use dal interfaces methods. I also check validation rules in this area.
From SOLID rule D, for escape create too much new IDals I use Ninject. In BusineesModule I load all of I use interfaces with NinjectModule. Then I created a InstanceFactory to return BusineesModule's kernel.
EmployeeValidator class keeps rule for data access. It allows escape empty inputs or wrong get accesses. On the other hand, ValidationTool throw exceptions when there is a problem in validation of Validator.
If you click an employee from table and click the "Update Employee" box, full name and work position automatically filled.
Filling automatically is also here.