irepository

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); }

工具导航Map