c# - Basic/Simple Data Access Object (DAO) with Entity Framework 4.0 -


I try to collect a simple POC for an en-layer application using EF4 in the data layer I am here. I have seen many examples on the web and it is a common practice to use a DAO or repository as an ORM cover. I understand that the main difference between the two is that a repository is more common and takes the IQueryable for example for parameters. I would like to paste it with simple DAO objects at this point, which is called GetPersonByFirstName (string name) Just like the specific methods will be included, similarly the ADO Net-based accessories have also been done earlier. He said, I still need many "cross cutting" attributes for my DAO.

  1. How would I have to go about sharing the reference between the DAO? Preferably this would be a way where the DAO would not have the knowledge of the business object EF to start. Initially I was thinking that BO will pass the session to the DAO, but it will violate my requirement of freedom of BO (unless I am thinking nothing). Maybe some type of singleton / factory approach?
  2. Is there a better way to use ASP.NET applications' request requests? Actually set up a session-per-request type, but revised without any presentation level code.
  3. I think I can have a base class DAO with very basic CRUD methods, for all the DAO, but again not to the point of the IQueryable.
  4. I want to use TransactionScope within my business object to wrap my DAO (I'm not having this one issue).

Thank you!

After doing some further research, it seems that I am on the right track in the HttpContext.Items unit framework There are many solutions of reference storage that basically make a factory that manages the lifetime of the EF reference. My main issue with that solution is that my library non-web projects will not work, so I think I need to go down the route to use the IoC container (instead of factory) object-per-request This way, if I want to use my library in the console application, for example I can change the configuration like object-per-thread etc.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -