OK, fine! I will explain for this: First, repository is just for handler for each Table (in my opinions). But you must open connection first. Related to this:http://www.aspnetboilerplate.com/Pages/Documents/Unit-Of-Work If you want to open connection auto, mark method with [UnitOfWork] attribute. If you want to open connection by hand, inject IUnitOfWorkManager and implement by follow: Ex:
public void CreatePerson(CreatePersonInput input)
{
var person = new Person { Name = input.Name, EmailAddress = input.EmailAddress };
//_unitOfWorkManager.Begin() will open connection
using (var unitOfWork = _unitOfWorkManager.Begin())
{
_personRepository.Insert(person);
_statisticsRepository.IncrementPeopleCount();
unitOfWork.Complete();
}
}
Thanks for your reply. Could we define a solution for this, because i really want to use your current entities. I thought a solution: FlexibleTableNameAttribute : TableNameAttribute And in that attribute, we use a resource file for TableName, all table name will be handle in 1 file. When someone want to change TableName, it will be easier :D Currently, we don't know how many TableName existed in AbpFramework. With me, i must run update-database and see how many table in database to figure out.
Thanks and best regards
I have the same problem too... Anyone helps...
Hi, When program started, DI framework will collect all instance which IApplicationService implemented. The class inherited from IApplicationService will be used for your purpose. Ex: You have following: IExampleService: IApplicationService ExampleService: IExampleService If you don't call database, it doesn't have any problem. Service layer is separated with database.
Best regards