What is repository pattern in MVC.NET?
Submitted by: Administrator-Repository pattern is useful for decoupling entity operations form presentation, which allows easy mocking and unit testing.
-The Repository will delegate to the appropriate infrastructure services to get the job done. Encapsulating in the mechanisms of storage, retrieval and query is the most basic feature of a Repository implementation.
-Repository pattern is useful for decoupling entity operations form presentation, which allows easy mocking and unit testing.
-Most common queries should also be hard coded to the Repositories as methods. Which MVC.NET to implement repository pattern Controller would have 2 constructors on parameterless for framework to call, and the second one which takes repository as an input:
class myController: Controller
{
private IMyRepository repository;
// overloaded constructor
public myController(IMyRepository repository)
{
this.repository = repository;
}
// default constructor for framework to call
public myController()
{
//concreate implementation
myController(new someRepository());
}
public ActionResult Load()
{
// loading data from repository
var myData = repository.Load();
}
}
Submitted by: Administrator
-The Repository will delegate to the appropriate infrastructure services to get the job done. Encapsulating in the mechanisms of storage, retrieval and query is the most basic feature of a Repository implementation.
-Repository pattern is useful for decoupling entity operations form presentation, which allows easy mocking and unit testing.
-Most common queries should also be hard coded to the Repositories as methods. Which MVC.NET to implement repository pattern Controller would have 2 constructors on parameterless for framework to call, and the second one which takes repository as an input:
class myController: Controller
{
private IMyRepository repository;
// overloaded constructor
public myController(IMyRepository repository)
{
this.repository = repository;
}
// default constructor for framework to call
public myController()
{
//concreate implementation
myController(new someRepository());
}
public ActionResult Load()
{
// loading data from repository
var myData = repository.Load();
}
}
Submitted by: Administrator
Read Online ASP.Net MVC Job Interview Questions And Answers
Top ASP.Net MVC Questions
☺ | What is ASP.NET MVC? |
☺ | What is repository pattern in MVC.NET? |
☺ | Explain the page lifecycle of an ASP.NET MVC? |
☺ | Explain program to call the js function when the change is being made in the Dropdown list made in ASP.NET MVC? |
☺ | Explain significance of routing? |
Top Dot Net Technologies Categories
☺ | MSF Interview Questions. |
☺ | .Net Architecture Interview Questions. |
☺ | ASP.Net MVC Interview Questions. |
☺ | Entity Framework Interview Questions. |
☺ | C# (Sharp) Programming Language Interview Questions. |