repository-pattern

How to make parallel async queries in EF Core 3.0 with repository pattern?

前提是你 提交于 2020-12-11 09:09:57
问题 I have repository like public interface IEmployeeRepository { Task<EmployeeSettings> GetEmployeeSettings(int employeeId); Task<ICollection<DepartmentWorkPosition>> GetWorkPositions(int employeeId); } Constructor of repository (DbContext injection): public EmployeeRepository(EmployeeDbContext dbContext) { _dbContext = dbContext; } And call it in EF Core 2.0 like var settingsTask = _employeeRepository .GetEmployeeSettings(employeeId.Value); var workPositionsTask = _employeeRepository

How to make parallel async queries in EF Core 3.0 with repository pattern?

你说的曾经没有我的故事 提交于 2020-12-11 09:07:43
问题 I have repository like public interface IEmployeeRepository { Task<EmployeeSettings> GetEmployeeSettings(int employeeId); Task<ICollection<DepartmentWorkPosition>> GetWorkPositions(int employeeId); } Constructor of repository (DbContext injection): public EmployeeRepository(EmployeeDbContext dbContext) { _dbContext = dbContext; } And call it in EF Core 2.0 like var settingsTask = _employeeRepository .GetEmployeeSettings(employeeId.Value); var workPositionsTask = _employeeRepository

How to make parallel async queries in EF Core 3.0 with repository pattern?

心不动则不痛 提交于 2020-12-11 09:07:19
问题 I have repository like public interface IEmployeeRepository { Task<EmployeeSettings> GetEmployeeSettings(int employeeId); Task<ICollection<DepartmentWorkPosition>> GetWorkPositions(int employeeId); } Constructor of repository (DbContext injection): public EmployeeRepository(EmployeeDbContext dbContext) { _dbContext = dbContext; } And call it in EF Core 2.0 like var settingsTask = _employeeRepository .GetEmployeeSettings(employeeId.Value); var workPositionsTask = _employeeRepository

How to make parallel async queries in EF Core 3.0 with repository pattern?

末鹿安然 提交于 2020-12-11 09:06:09
问题 I have repository like public interface IEmployeeRepository { Task<EmployeeSettings> GetEmployeeSettings(int employeeId); Task<ICollection<DepartmentWorkPosition>> GetWorkPositions(int employeeId); } Constructor of repository (DbContext injection): public EmployeeRepository(EmployeeDbContext dbContext) { _dbContext = dbContext; } And call it in EF Core 2.0 like var settingsTask = _employeeRepository .GetEmployeeSettings(employeeId.Value); var workPositionsTask = _employeeRepository

Where does paging, sorting, etc go in repository pattern?

戏子无情 提交于 2020-07-16 16:34:31
问题 Where do we put the logic for paging and sorting data in an asp.net repository pattern project? Should it go in the service layer or put it in the controller and have the controller directly call the repository? Controller -> Repository is shown here for a jquery grid. But unlike that article, my repository returns IQueryable<datatype> 回答1: It should go in the Repository if your Repository returns materialized sequences ( ICollection<T> , List<T> ), etc. But if your returning IQueryable<T>

Unable to hit oracle stored proc using .Net EF(2.2) Core repository pattern

送分小仙女□ 提交于 2020-04-18 00:50:47
问题 ORA-00900: invalid SQL statement This is the error i get when i am trying to hit a stored procedure(in Oracle) from my API. I am using Repository pattern with Entity framework.(EF Core 2.2) This is my call, return FetchWithStoredProcedure("PROC_GETMYPROC", new OracleParameter("PARAM1", OracleDbType.Int32, ParameterDirection.Input) { Value = PageNo }, new OracleParameter("PARAM2", OracleDbType.Int32,ParameterDirection.Input) { Value = PageSize }, new OracleParameter("PARAM3", OracleDbType

Repository design pattern - should there be one repo for every Dao?

本小妞迷上赌 提交于 2020-02-21 18:16:23
问题 i have a few DAOs in my app which access a database for CRUD operations. Lets say there News, weather and , sports DAO. So im confused on how many Repositories i would need. should i just use one repository say DataRepository and let me hold my database and all dao's. and encapsulate methods for the CRUD operations in it ? or should each DAO have its own repository ? I mean a repository should return only data objects that the calling layer understands. so its like a encapsulation over the

Repository design pattern - should there be one repo for every Dao?

放肆的年华 提交于 2020-02-21 18:14:49
问题 i have a few DAOs in my app which access a database for CRUD operations. Lets say there News, weather and , sports DAO. So im confused on how many Repositories i would need. should i just use one repository say DataRepository and let me hold my database and all dao's. and encapsulate methods for the CRUD operations in it ? or should each DAO have its own repository ? I mean a repository should return only data objects that the calling layer understands. so its like a encapsulation over the

Repository design pattern - should there be one repo for every Dao?

倾然丶 夕夏残阳落幕 提交于 2020-02-21 18:08:40
问题 i have a few DAOs in my app which access a database for CRUD operations. Lets say there News, weather and , sports DAO. So im confused on how many Repositories i would need. should i just use one repository say DataRepository and let me hold my database and all dao's. and encapsulate methods for the CRUD operations in it ? or should each DAO have its own repository ? I mean a repository should return only data objects that the calling layer understands. so its like a encapsulation over the

User roles and authorization

对着背影说爱祢 提交于 2020-02-07 12:25:48
问题 So I want to create a login page where when you enter your login credentials as a admin you get acces. If you are not a admin you get redirected back to the login page. In my database I have a field of boolean type: isAdmin <--datatype(byte") So how can you the best way do this?! I would like to do this in the repository pattern way as it gets easier to unit test it then. I have googled this a lot and starting to get a bit confused on the matter. How many classes, models etc should I have?! I