irepository

Am I using IRepository correctly?

删除回忆录丶 提交于 2020-01-30 18:55:10
问题 I'm looking to use the IRepository pattern (backed by NHibernate, if it matters) in a small project. The domain is a simple one, intentionally so to allow me to focus on understanding the IRepository pattern. The lone domain class is Movie , with properties for Year , Genre , and Title . My intent would be to "get" movies whose properties match criteria of the aforementioned types. Convention seems to be to have a generic IRepository interface, similar to the following: public interface

Am I using IRepository correctly?

喜夏-厌秋 提交于 2020-01-30 18:54:05
问题 I'm looking to use the IRepository pattern (backed by NHibernate, if it matters) in a small project. The domain is a simple one, intentionally so to allow me to focus on understanding the IRepository pattern. The lone domain class is Movie , with properties for Year , Genre , and Title . My intent would be to "get" movies whose properties match criteria of the aforementioned types. Convention seems to be to have a generic IRepository interface, similar to the following: public interface

ninject inject iunitofwork to repository scoped attribute

风流意气都作罢 提交于 2020-01-04 11:08:14
问题 Let me start with my current setup, and then explain what I am trying to achieve. We are using NHibernate and trying to implement the IRepository/IUnitOfWork pattern with Ninject. It should ideally work generically for whatever application is using the code, whether is ASP.Net, WCF or something else. IUnitOfWork public interface IUnitOfWork { object Add(object obj);//all other supported CRUD operations we want to expose void Commit(); void Rollback(); } UnitOfWork public class UnitOfWork :

Orchard IRepository vs. Linq to SQL

痴心易碎 提交于 2019-12-13 19:50:45
问题 In Orchard CMS using IRepository<> is quite common. So i ask myself, what is the advantage of using IRepository<> and its Fetch() method instead of simply using Linq to SQL to query data? IRepository<> Repository.Fetch(r => r.ID == 1234).Select(r => r.Name) The disadvantage here is that i have to inject the repository in the constructor. Linq to SQL from r in Repository where r.ID == 1234 select r.Name 回答1: Generally Repositories are an abstraction on top of your data access code. You may

C# Shared Transactions and NHibernate using IRepository

佐手、 提交于 2019-12-08 13:44:45
问题 I'm looking into implementing the IRepository pattern using NHibernate and I have question that I've not been able to answer searching the net. Assume I have 3 Repositories, PersonRepository, PersonAddressRepository and PersonAccountRepository. Now assume that business logic dictates that there be an "Deactivate Person" process that calls PersonRepository.Deactivate(), PersonAddressRepository.Deactivate() and PersonAccountRepository.Deactivate(). I want to be able to do something along the

IRepository confusion on objects returned

天涯浪子 提交于 2019-12-04 15:57:05
问题 I have some e-commerce code that I use often that uses Linq To SQL for saving orders to the database. I want to remove the tightly coupled Linq to SQL bit and pass in an IRepository instead but I am still a little confused on things. Say I have a GetCustomer() method on my ICustomerRepository that returns a Customer object. Do I need it to really return an ICustomer object that gets passed back from that method so if I switch from Linq To SQL to say SubSonic it's not a problem? I believe I do

IRepository confusion on objects returned

北城以北 提交于 2019-12-03 09:09:28
I have some e-commerce code that I use often that uses Linq To SQL for saving orders to the database. I want to remove the tightly coupled Linq to SQL bit and pass in an IRepository instead but I am still a little confused on things. Say I have a GetCustomer() method on my ICustomerRepository that returns a Customer object. Do I need it to really return an ICustomer object that gets passed back from that method so if I switch from Linq To SQL to say SubSonic it's not a problem? I believe I do, if that is the case is there a way in Linq To SQL to easily convert my Linq To SQL Customer object to

Am I using IRepository correctly?

耗尽温柔 提交于 2019-12-02 22:16:39
I'm looking to use the IRepository pattern (backed by NHibernate, if it matters) in a small project. The domain is a simple one, intentionally so to allow me to focus on understanding the IRepository pattern. The lone domain class is Movie , with properties for Year , Genre , and Title . My intent would be to "get" movies whose properties match criteria of the aforementioned types. Convention seems to be to have a generic IRepository interface, similar to the following: public interface IRepository<T> { T Get(int id); T[] GetAll(); void Add(T item); void Update(T item); void Delete(T item); }